feat: Aggregate.evaluate/2 returns {:ok, [events]}#31
Merged
Conversation
8780f5d to
8b1ba5e
Compare
8b1ba5e to
2c083d0
Compare
7d808eb to
8073734
Compare
- Add the option `evaluate(command, return: :events | :state)` which returns events generated by the command, or the aggregate state after the command. - Keep the default behavio(u)r of evaluate which does not return events or state across the process boundary. This simplifies a caller that wants to use valid events for applications outside the scope of maestro itself.
8073734 to
a369819
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sometimes it's nice to update the aggregate state and know on success exactly which events were just applied. In the case that events are large it might be nice to avoid returning them across the process boundary, so this change leaves the existing
evaluatebehavior as the default. It adds an option toevaluate,return: :events | :state, which returns the events or state on success. Our application displays some events directly in the frontend and would like to broadcast new events only after the transaction creating them has been committed.