Ran into an issue trying to upgrade from Axon version 2.4.6 to version 3.1.3. The use case is described below and it works in 2.4.6, but doesn’t work in 3.1.3. Basically, a commandGateway.sendAndWait() call is not throwing an AggregateNotFoundException when there is no aggregate to handle the command.
Using distributed command bus with JGroups connector.
Use Case:
-
Service layer invokes CommandGateway.sendAndWait with timeout.
-
Aggregate 1 handles the command and publishes created event.
-
A Saga’s event handler for that event then sends a command by invoking CommandGateway.sendAndWait to see if Aggregate 2 exists. If an AggregateNotFoundException is thrown, then we know that Aggregate 2 doesn’t exist and the Saga sends a create command for Aggregate 2.
-
The issue is that the AggregateNotFoundException is never thrown, and the SendAndWait never returns. The 1st sendAndWait eventually times out since the 2nd sendAndWait never returns.
Service -> SendAndWait(30 sec timeout) -> Aggregate 1 created
Aggregate 1 -> Created Event -> Saga Event Handler
Saga EventHandler -> SendAndWait -> Aggregate 2