Axon Framework- is it possible to have an aggregate handle commands from multiple sagas?

795 views Asked by At

I'd like to use one aggregate to handle commands from multiple sagas. Unfortunately, if a saga sends a command while the aggregate is busy handling another command, the command is lost with an AggregateNotFoundException written to the log.

I can use one aggregate per saga, but I'd like to know if it is possible with one aggregate for all sagas.

1

There are 1 answers

1
Allard On BEST ANSWER

in Axon, a Command Handler isn't interested in the source of the command. Therefore, it doesn't matter whether multiple Sagas send commands, or if there is just one source.

I think the problem here is more related to a race condition. If a Command results in an AggregateNotFoundException, it means that the Command creating the Aggregate hasn't been processed, yet.

Most likely, there is an issue in the model/design, that causes these race conditions to appear. However, to be able to judge that, I would need much more information about your design and what you're trying to achieve with it.