Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events may appear out of sequence when using allEvents instead of eventsByPersistenceId #125

Closed
mkurth opened this issue Oct 7, 2016 · 1 comment
Labels

Comments

@mkurth
Copy link

mkurth commented Oct 7, 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

@scullxbones
Copy link
Owner

Hi @mkurth

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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants