Hi Allard and all,
I’m looking for an approach to the interaction between 2 aggregates as example
1AR and 2AR have commands ADD and REMOVE.
Read topic i found 3 set:
1.Send command REMOVE to 1AR it generates event REMOVED->event handler catch and generates
command ADD to 2AR if exception occurred event handler generates revert command ADD to 1AR ( as singleton saga)
2.Inject 2AR reposiory in 1AR and do as UoW and publish events ADDED REMOVED after commit.
3.Make service that send command REMOVE to 1AR , ADD to 2AR if exception occurred send revert command ADD to 1AR.
First can not return exceptions for clients, second i dislike, third i like.
What aproach is better for simple application for example.
serviceAPIAdapter have client api and translates it generates commands, make query for validations return exceptions etc.
For set 3 in above client invoke method on serviceAPIAdapter than service query for validations if ok send REMOVE to AR1 if ok send ADD to AR2 if exception occurred send command ADD to AR1 exception return to client.
Do I understand right approaches and what weaknesses is in my example.