Saga Reactions

When a saga is using an @SagaEventHandler to react to domain events is it best to schedule an internal event before processing a new command?

As an example I define two aggregates and one depends on the other for something. So when aggregate "A" publishes a "ItemAddedEvent" then aggregate "B" can be dispatched a command "AddToOrderCommand".

- aggregate "A" published "ItemAddedEvent"
- saga listening for that event schedules a "AddItemScheduledEvent" 100ms into the future
- saga listens for "AddItemScheduledEvent" and then dispatches "AddToOrderCommand"
- aggregate "B" processes command.

Or is it sufficient to just:

- aggregate "A" published "ItemAddedEvent"
- saga listens for "ItemAddedEvent" and then dispatches "AddToOrderCommand"
- aggregate "B" processes command.

My concern is threading. Should I be concerned?

Thanks,
Randy.

Hi Randy,

unless there is a business requirement for delaying the command to aggregate B, don't do it. Don't worry about threading (or other infrastructural logic) in places where only business logic should be.
Axon will make sure threading is not an issue. Ut doesn't matter if you use a single thread SimpleCommand/EventBus or multiple. That's an infrastructure choice you can put in Axon configuration.

Cheers,

Allard