Axon 4.0 Handling exceptions in Saga


how are the Runtime Exceptions handled in Saga SagaEventHandler? I thought if runtime exception is thrown then the event handler will retry.
Is my understanding wrong or there must be some configuration?
I use Axon 4.0, Spring Boot 2.0.5, JPA and Quartz




Hi Pavel,

Saga’s do not deal with exception in a specific way, it’s their underlying process which performs specific logic.
Exceptions which are thrown in your message handling functions, so the @SagaEventHandler, will typically just be logged, as that’s the default (being the ‘LoggingErrorHandler’) for the ListenerInvocationErrorHandler.
Hence, this process will not be retried with default settings.

Exceptions happening higher up the chain, in your Event Processor, will get propagated through with the PropagatingErrorHandler.
If you are using a Tracking Event Processor for your Sagas, which is the default in Axon 4, this means the Tracking Token will not be updated.
This results in the operation being retried, as the Tracking Event Processor cannot proceed passed this event.

So, what you might want to configure, is the ListenerInvocationErrorHandler for the Saga Manager, if you need to retry.

So in general sagas are no different than any other event handling component in your system, thus my statement that Saga do not perform anything specific in that respect.

Hope this gives you some insights.