-
Notifications
You must be signed in to change notification settings - Fork 178
Description
Hi! My team has started to use Spring Modulith, and we're starting to see a high complexity in how we utilize events to communicate between modules. I have identified that the complexity is when we use events for request and response. For example:
We have module A that contains the function "LongRunningTask". In order to start the task Module B or C publishes the event "LongRunningTaskRequested". The event has one field, a UUID named "requester". This UUID is also stored in the calling module to later identity if the response is for that module.
The "LongRunningTaskRequested" event is listened to by module A, and when finished, it will raise either the event "LongRunningTaskCompleted" or "LongRunningTaskFailed". Both these events includes the UUID. Module B and C both subscribes to these events.
In order for Module B or C to know if it were it that the event is targeted for, it guard checks the UUID to see if it was the requester of the long running task. If it was not the requester, it simply returns.
This request/response does not feel very convienent when using application events. We would rather have direct communication for this scenario. But I'm not sure we're breaking any modulith rule or introducing bad practices by not using events.
Any feedback and/or resources to gather knowledge is very appreciated.
Thanks