Axon Framework not supporting Spring global exception handler(@ControllerAdvice).#Axon

hi team,
when i am handling exceptions before Axon Event started, i can able to handle exceptions globally by using Spring @ControllerAdvice. After Axon Event is fired if i got Exception Control is not going to global Exception Handler.

is Axon not supporting global exception handler with @ControllerAdvice?

can you anyone give the solution for this issue .

Thanks

Hi Siddu,

I notice this is a copy of the question you’ve posed on the issue tracker (to be found here).
For clarity I will rehash the comments shared there by me and Allard:

abuijze commented on Apr 14

Hi,

@ControllerAdvice is a Spring Web annotation. Not sure what kind of support you’re expecting, but Axon doesn’t take any part in Web/UI logic.
Also note that event handling is, by default, asynchronous. That means any exceptions thrown by event handlers will not be seen by the component that dispatched the event.

I’m closing this issue, as it’s a question. Feel free to comment if you think there is something missing/wrong in the framework.

On this you reacted with the following:

Hi Allard, Sorry for posting the question. But axon framework is restricting to handle exception in controller advice, if start the events with saga. Thanks and Regards Siddu 8553318153

Followed by my comment:

Regardless of where the event comes from @SidduSid, it’s still an asynchronous process.

Thus, there is no way to respond on successful or faulty event handling.

But axon framework is restricting to handle exception in controller advice, if start the events with saga.
So this isn’t a choice of Axon Framework, it’s a given due to the nature of the type of message you are using. This would (should) apply regardless of the framework you are using.

The Saga you use executes on an Event.
The definition of “event” is “something important which has happened inside the domain”.
Has happened is important in here. It’s past tense, so it’s history, an event. Think of it that in real life you cant change history either. Thus the fact that the event occurred cannot be rolled back.

Thus, the only way to deal with faulty processing inside, for example a Saga, is by performing a compensating action.

Hope this clarifies things for your and other readers of this thread.

Cheers,

Steven van Beelen

Axon Framework Lead Developer

AxonIQ

twitter-icon_128x128.png