I want to programmatically add filters to custom Projection stream so that not all events are written in the projection

Hi all!

Have any of you encountered such a case in .NET? I have a stream which will have upwards of tens of thousands of events in it as there are a lot of aggregates of that kind being created every day. The only event out of the entire stream is _myAggregateName_Created event. I have created a separate cp Projection that includes all events of that type. In that projection, I wish to send out a command over HTTP to another microservice, but that’s besides the point. I know I will have a lot of _myAggregateName_Created events inside the projection which will only waste disk space due to the fact that I’m not interested in every single one of them - but only those that sattisfy a defined criteria (lets say they have a non null designated field).

As I want to create it programmatically, i.e. I want users of my abstracted ES implementation to interact with it using my own API in which I would presumably add an Func<T, bool> which would somehow get injected into Projection specification.

I hope I have made the point clear enough!

All the best,
Mladen

I read your message twice but I have to say I don’t really understand what you are trying to do. By custom projection you mean a server-side JS projection or a .NET code with catch-up subscription? If you are interested in a stream that only includes events of a certain type, it’s already built-in as the by-eventtype system projection.