Idea: Event filtering from MultiStreamProjection #2608
Unanswered
elexisvenator
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sometimes when defining a MultiStreamProjection, there is value in excluding events based on certain conditions.
My specific example is a projection that tracks users and the 5 most "recent" documents they have interacted with. In this case I want to exclude document interactions performed by an internal system user, as they are both not useful and also performed very often compared to other users.
For a more straightforward example. Consider this example of users adopting pets, and a projection that tracks cat owners:
With the current version of marten a projection would look like this:
To actually apply the filter of "cats only" there are a few approaches.
The most obvious one is to filter the behaviour in the apply methods, but this causes all the dog owners to also have records even if they have no cats.
A hacky approach is to change all maps to
Identities
and return an empty collection for dog events.The only other way is to do a custom Grouper or custom Slicer.
Proposal
There is nothing wrong with these approaches, but I would like to propose adding filtering directly to the
Identity
methods.This could be done fluidly, or as a method overload.
Is this a feature that would be worth considering? Maybe it's too niche?
Beta Was this translation helpful? Give feedback.
All reactions