0
votes

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
In theory (so not specific to axon) it should be possible, it is a perfectly valid use case, an Aggregate can (and most probably) should handle more commandsConstantin Galbenu

1 Answers

4
votes

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.