Hello
I just switched from the SimpleCommandBus to AsyncCommandBus. Because of this switch I had to change the publishing method of commands in one of my sagas from sendAndWait to send. Using send caused a Deadlock when loading the state of an aggregate.
So whats my situation
I have an aggregate A which uses a Saga S to handle it’s long-running tasks. I make an example to make this clear. The logic in aggregate A decides that a long-running task T as to be executed. Aggregate A therefore fires an event E which is handled by Saga S. Saga S then calls one ore more services to execute this task T. I think using a saga is the right choice here.
So when the task is finished the Saga S sends a command which is handled by the same Aggregate A. Aggregate A then may decides to execute a further task which again would be handled by the Saga S or to send a “finish-event” which causes the Saga S to end.
Now to my question
In the intro I told that I had to change the way the Saga S sends commands (from sendAndWait to send). Because of that I made some research and found a comment in this google group that it would be a code smell when saga sends commands back to its calling aggregate (see post)!
Now I am wondering how I should model my logic? Any hints are highly appreciated
Cheers
Marco
P.S: I am using axon-framework 3.3