I understand that Saga is used for either long running task , or complex interactions among aggregates.
For the long running task, Saga + deadline manager would be the best choice , but for the interactions between aggregates , if it’s not so complex, can we simply send a command in the command handler to another aggregate ? Is it a code smell ?
You can use the event handler to send another command from one aggregate to the other. Catch the event of aggregate-1 in event handler and from event handler send command to aggregate-2.
Thank you. So the 1st aggregate act as the client of the 2nd aggregate . should the event handler defined in the sending aggregate as well or in a new class ?
Hi,
I believe new class is better approach.
In the separate class you can catch event from the aggregate-1 and using the command gateway u can send the a command to aggregate-2.
In this case event handler act as the client for aggregate-2 because the event handler who send the command to aggregate-2 .