Hi,
I have a question related to ensuring that an event is only projected once.
I’ve read this blog post by Oskar Dudycz: https://event-driven.io/en/dealing_with_eventual_consistency_and_idempotency_in_mongodb_projections/ which addresses this.
If I’ve understood correctly, basically the trick is to make use of the event revision in the stream the event belongs to (e.g Order-155). Even though your subscription is subscribing to the $all stream - when recieving an event it knows the original stream id and revision. So then it’s quite easy to use this to make idempotent projections - when doing projections for a single stream. But often - in our systems - we want to make cross aggregate projections as well.
So my question is really if you have any recommendations - to make these projections idempotent.
Oskar mentions in his blog post: “Of course, what I showed here is the handling of the single stream. For multiple, things get more complex. We either have to maintain various revisions for each stream or store the event’s global position in a separate collection.”
I see storing the event’s global position in a separate collection could a viable solution. Then this maybe could (or maybe must be?) a separate projection.