Axon 2.4.6 to 3.1.3 upgrade issue with commandGateway.sendAndWait

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

Hi Jeff,

this sounds very much like an issue that we recently resolved in 3.3.6: https://github.com/AxonFramework/AxonFramework/issues/777
This was related to the fact that JGroups doesn’t like sending messages in the thread that also received them.

I would recommend upgrading to 3.3.6 (or the 4.0, which we are about to release).

Cheers,

Allard