-
Hi! It is about throttling. How do we prevent the EventStore to be 'abused', let's say a process starts to send an event every second, exactly the sameone. Do we want to store as it is? Which will be the best approach to deal with this:
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello, I may have trouble understanding your request, but some thoughts: Why is your event producer producing events with equal identity? Or are you talking more about "structural equality", whereby an instance of an event will have fields with exactly the same values as some other event already stored in the stream? Nevertheless, if you want some kind of "throttling", could you buffer & filter the events in the producer side? On the question of storing them, it should depend on the application domain. So if you consider events "duplicate", handle them so in projections. If you really want to prevent inserting them, you could e.g. keep a projection that maintains hashes of the seen events, but that ofc incurs cost of querying the projection for each insertion (which is certainly less expensive than querying the whole underlying stream)...
and then upon appending to a stream, something like
|
Beta Was this translation helpful? Give feedback.
-
@jokokko, thanks a lot for that. IN our domain, we are indeed producing events with same identity (it is a kind of long running saga), and indeed in some cases the 'payload' or event data can be the same. Thanks for the samples! |
Beta Was this translation helpful? Give feedback.
Hello,
I may have trouble understanding your request, but some thoughts: Why is your event producer producing events with equal identity? Or are you talking more about "structural equality", whereby an instance of an event will have fields with exactly the same values as some other event already stored in the stream? Nevertheless, if you want some kind of "throttling", could you buffer & filter the events in the producer side? On the question of storing them, it should depend on the application domain. So if you consider events "duplicate", handle them so in projections.
If you really want to prevent inserting them, you could e.g. keep a projection that maintains hashes of the seen events…