Hi ,
I have a DeletionCommand that will be handled and send another DeletionCommand and may send more for cascading deletion . All of DeletionCommands have different global unique TargetAggregateIdentifier.
something like :
-
sendAndWait(DeletionCommand(“1001”)) in RestController
-
sendAndWait(DeletionCommand(“1002”)) in Aggregate
-
apply(SomethingDelevedEvent)
-
sendAndWait(DeletionCommand(“1003”)) in Aggregate
-
apply(SomethingDelevedEvent)
It works well with SimpleCommandBus, but when switching to AsynchronousCommandBus , the EventHandler of SomethingDelevedEvent is not triggered anymore and there’s no exception in the log . I’m using subscription query + update emitter for sync UI request, so the UI hangs if EventHandler is not trigger.
If I use send instead of sendAndWait for #2 & #4, then SomethingDelevedEvent is triggered. But I do want the cascading DeletionCommands are executed sequentially.
Why does AsynchronousCommandBus behave like this and how can I run the commands one by one ?
Regards,
Sean