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

Question: why we need to validate version in command handler? #1

Open
davideicardi opened this issue Sep 29, 2020 · 1 comment
Open

Comments

@davideicardi
Copy link

Thanks for sharing your code! Very interesting!

Just one question:
I see that you do an "optimistic lock" by checking the expected version in the command with the version of the snapshot.
Why you need this?

I mean using Kafka "exactly once" does not guarantee that there is only one "thread" that apply commands on a single aggregate, so why checking the version. I would expect that it always match.

@davideicardi
Copy link
Author

davideicardi commented Oct 10, 2020

I have tried to write a similar POC but without the "optimistic lock" and with some changes:
https://github.com/davideicardi/books-catalog-es

I appreciate any feedback.

The most important part is the event sourcing topology described here:
image)

Code is here: https://github.com/davideicardi/books-catalog-es/blob/master/sample/src/main/scala/catalog/authors/streaming/AuthorsTopology.scala

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant