in the existing topics i couldn’t find any answer, therefore i created this topic.
We created aggegates for persons and for contracts. Now i have a command which opens a new contract process for 2 persons (for example lawyer and client) and it is necessary to keep the contractid in a list inside the person aggregates.
The command looks like this:
The command will be consumed by the lawyer and it will trigger an update of the internal list of contracts inside the lawyer. The same behaviour i need for the client and i have currently no good idea to do it, what is the designated way to do it?!
Option 1: Create a Saga which will be triggered on contractStarted event (result of startContract after passing aggregat) and create a command to add the conractId to the client. This feels like a technical workaround and the new command addContractToClient is not driven by business values.
Option 2: Use a domain service (CommandHandler outside the aggregat) to load the aggregates via repository and update the lists, but which aggregat is responsible for the apply(…) to persist and publish the event?! Is there any chance to do the apply(…) with the domain service?!
Option 3: Implement command startContractForLawyer and startContractForClient and the resulting events will be catched by a saga to create the event contractStarted for the contract aggregat
I hope someone can help, thanks in advance.