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

No way to signal no change with ChangeEventHandler #32310

Open
johanandren opened this issue Feb 19, 2024 · 2 comments
Open

No way to signal no change with ChangeEventHandler #32310

johanandren opened this issue Feb 19, 2024 · 2 comments

Comments

@johanandren
Copy link
Member

From forum question: https://discuss.lightbend.com/t/changeeventhandler-no-op/10620/3

The updateHandler has signature (State, State, Command) => ChangeEvent so there is no way to say a command had no effect on the state.

@johanandren
Copy link
Member Author

Alternatively, if we want to require that a ChangeEvent is always returned, we should document that it isn't called for commands that doesn't change the state and show how to do a catch-ignore for those to satisfy the Scala (and Java) compiler completeness checker.

@patriknw
Copy link
Member

Adding documentation makes sense.

The event sequence number must be in sync with the durable state change revision, i.e. one event per change. Therefore I think it is best to not make the ChangeEvent optional (even though we could store that hidden ignore payload).

Calling the change handler also for non-changes doesn't make sense, because we can't store additional events when there is no revision change. Again, sync of sequence numbers.

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

2 participants