Replies: 1 comment
-
As of v0.9.0, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Protean allows publishing new events with the
domain.publish()
method:This approach disconnects the event from its source, allowing any code anywhere to be able to raise an event (in Application services, Command handlers, or even Subscribers for example). But ideally, we want events only to be raised on state change, specifically in the aggregate method performing the state change.
So it is better to make it impossible to raise events unless they are bubbled by the aggregates undergoing the change. An API like this would make more sense:
Each aggregate would have a built-in
events
array that is populated within state-change methods, The events are consumed by the UnitOfWork on commit and dispatched to the broker.Beta Was this translation helpful? Give feedback.
All reactions