Define an event as the sum of two events #1615
-
Hello, I was wondering how to handle the following scenario :
So is there a way to raise a event and wait for another event to launch an action when both are there ? Thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello, what you've described fits perfectly into a definition of a Process. There are certain condition to be met over time (expressed with A component that handles such processes is called a Process Manager. It takes events as input (something happened), issuing a command when all conditions are met (do something):
In RailsEventStore this would be an event handler. Such handler needs to be subscribed to both events you've mentioned. Also both events need to have something in common, i.e. an identifier of entity they describe (like Another thing to implement in this handler is state management, as we need to keep track of the process over time. State can be event-sourced — for example by linking events related to a process into a given stream and checking whether state is "complete" each time new event arrives. Alternatively state can be tracked differently, i.e. in a database table. When testing, it is useful to check all permutations of input events. They may arrive out of order due to messaging infrastructure. Yet that should make no difference to the process. |
Beta Was this translation helpful? Give feedback.
Hello,
what you've described fits perfectly into a definition of a Process. There are certain condition to be met over time (expressed with
ProfileUpdated
andAvatarUpdated
events). When they all happen, a barrier breaks and we propagate changes.A component that handles such processes is called a Process Manager. It takes events as input (something happened), issuing a command when all conditions are met (do something):
In RailsEventStore this would be an event handler. Such handler needs to be subscribed to both events you've mentioned. Also both events need to have something in common, i.e. an identifier of entity they describe (like
profile_id
), so that we could …