-
Notifications
You must be signed in to change notification settings - Fork 103
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
How to handle incomming integration events? #14
Comments
Hi @alibabashack |
Okay, it might feel a bit staged, but let's amend your example with an additional service called Driver Work Time Tracking. Among other things, this service is also used by drivers to call in sick. The service has a command callInSickForToday(driverId). And there is a new business rule:
Let's assume we want to implement this using the event choreography approach. Hence, there is no direct command from the Driver Work Time Tracking, but instead DriverAbsent(driverId) integration events are emitted towards the Order service using some kind of message broker. My questions are:
Meanwhile, I understood that an aggregate is not allowed to change state by accepting events directly (neither internal domain events, nor integration events). An aggregate only acts upon commands. Events being emitted is the result of a command, only.
|
@alibabashack, sorry for the late answer.
Correct.
Call it Integration Event Listener. In my example |
Thank you very much @eugene-khyst ! Especially the paragraph about Domain events vs Integration events was an eye-opener.
I am currently wondering how replaying of events works and how the system state can be reliably recreated (conceptually). A reason to do that might be an added or modified projection (e.g. to add another column in a table providing extra information which can be extrapolated from existing events).
This seems to be strait forward when only internal domain events contribute to the aggregate's state. We simply drop the table(s) belonging to the projection, then pipe all historic events through the new/changed event handler of the projection and finally continue to feed new events synchronously.
But, can't we also have aggregates that perform state changes due to incoming integration events? (I am unsure if this is conceptually correct.)
How would we deal with incoming integration events in this case? In order to be able to replay events later, it seems to me, that the incoming events need to be enqueued into the event store along with the internal domain events, because only then we are able to preserve their exact order of processing relative to the internal events.
So in this case we had some process receiving incoming integration events. First, it sticks them into the event store (while dropping repeatedly delivered events). Then it hands them over to synchronous event processing (but not asynchronous forwarding). Finally, it acknowledges the reception to the event broker.
Does this sound valid or is there a better pattern? I am thankful for every comment.
The text was updated successfully, but these errors were encountered: