Reacting to Injected Events
The code to react to an injected event is easy: just handle the event. The trick, as with all things event-sourced, is how to design the model properly. When evaluating whether something should be injected and where it should be injected, you can ask these questions:
-
Does the external event represent something important to the components in your system?
-
Does the event occur without the aid of an internal command?
-
Does the occurrence of the event have meaning beyond the ephemeral state?
-
Does the occurrence of the event also affect the state of an aggregate in your system?
If an external event occurs without the aid of a command in your system but its occurrence signifies something important that can impact projections, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access