Changing ErrorHandler of running AsyncAnnotatedSagaManager


I ran into a problem using AsyncSagaEventProcessor#setErrorHandler:
Before calling AsyncSagaEventProcessor#stop I want to prevent all errors from sending the saga manager into a retry loop while still being able to retry after non transient exceptions while the system is running.

My understanding would be that AsyncSagaEventProcessor#setErrorHandle can be used to change the error handling after the saga manger was started but this is not the case. In AsyncSagaEventProcessor#start the currently set ErrorHandler is propagated to AsyncSagaEventProcessor#createInstances but within AsyncSagaEventProcessor instances the ErrorHandler is final and using AsyncSagaEventProcessor#setErrorHandler does not affect the AsyncSagaEventProcessor instances.

Are there any specific issues which would prevent making the ErrorHandler within AsyncSagaEventProcessor instances modifiable?
Has anybody ever run into a similar problem?
Is this actually a bug or is my understanding wrong?

As a workaround I am thinking of using a custom ErrorHandler which itself is just a holder of another modifiable ErrorHandler to be able to change the error handling while the system is running.


Hi Klaus,

the ErrorHandler mechanism just hasn’t been designed to be modified at runtime. There is no deep underlying reason why this can’t be done.

In your case, an ErrorHandler that wraps two others, or otherwise has some state based on which the decision to retry or not is made sounds like a suitable approach.