SagaEventHandler not getting called when event published through Event Bus

Hi,

I am sending a command C1 which is applying event E1 on an aggregate.
This event E1 starts a new saga.
Inside this event E1 i am sending another command which is publishing second event E2 on the event bus.
The second event E2’s saga handler is not getting called.
When i debugged i could see for the second event E2 there is no saga stored in the database when invokeExistingSaga-> jpaSagaRepository->findAssociatedSagaIdentifiers() is called.

Is there any way i can commit the new created saga before the second event E2 checks for existing saga?

Cheers,
Prashant tiwari

Hi Prashant,

this sounds very similar to AXON-188 (http://issues.axonframework.org/youtrack/issue/AXON-188), which has been fixed in 2.0.6.
Are you using 2.0.6 or an earlier version?

Cheers,

Allard

Hi Allard,

I am using axon 2.0.5, will try with 2.0.6.
Thanks for the information.

Cheers,
Prashant

Great! Please let me know if it resolved your problem.

Cheers,

Allard

Hi Allard,

I tried with axon 2.0.6 and still facing the same issue.
Although i am getting the sagaId from sagaInCreation map, when the loadAndInvoke() is called and we are trying to load the newly created saga from the jpaSagaRepository the serializedSagaList is coming as empty and we return null.

Let me know if you need more information.

Cheers,
Prashant

Hi Prashant,

let me guess: you use the SimpleCommandBus and SimpleEventBus? Seems that my fix for AON-188 only works when the second event is handled by a different thread… I will look into this.

Cheers,

Allard

Hi Allard,

Yes, i used the simple command bus and simple event bus.

Cheers,
Prashant