You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have the problem, that we persist a lot of events in parallel, which will sometimes cause events with a higher sequence number to be inserted before a lower one.
This is no problem, when we use readJournal.eventsByPersistenceId() which uses a sort before running the RemoveDuplicatedEventsByPersistenceId.
But readJournal.allEvents() is missing a sort an therefore in the above case we would lose Event 4.
I'm not sure if we're doing something wrong (we're pretty new to CQRS + ES) or if this is a problem.
BTW we're using casbah as backend
The text was updated successfully, but these errors were encountered:
You're correct in that allEvents() uses no sort on sequenceNr. This means that it's not suitable for a use case that requires events to iterate in a sequenceNr order. I don't think it's accurate to say the events disappear, so i'm changing the title to reflect what you're saying above. There's a ticket to add a global ordering counter #95, but that work hasn't started yet.
Thanks!
scullxbones
changed the title
Events may disappear when using allEvents instead of eventsByPersistenceId
Events may appear out of sequence when using allEvents instead of eventsByPersistenceId
Oct 10, 2016
We have the problem, that we persist a lot of events in parallel, which will sometimes cause events with a higher sequence number to be inserted before a lower one.
So we have in our collection something like:
{.. from: 1 ..}, {.. from: 2 ..}, {.. from: 3 ..}, {.. from: 5 ..}, {.. from: 4 ..}
This is no problem, when we use
readJournal.eventsByPersistenceId()
which uses a sort before running the RemoveDuplicatedEventsByPersistenceId.But
readJournal.allEvents()
is missing a sort an therefore in the above case we would lose Event 4.I'm not sure if we're doing something wrong (we're pretty new to CQRS + ES) or if this is a problem.
BTW we're using casbah as backend
The text was updated successfully, but these errors were encountered: