Im looking into the error handling of integration to achieve the following: When an exception occurs, I'd like to store the original payload (in some format, assume XML) along with the error. (why the payload ? -> I like self-healing / auto recovery concepts.. )
In order todo so, I have two options (right?)
1) give the endpoint an error-handler that implements the ErrorHandler interface:
Do you see any issues to have handle likeCode:public interface ErrorHandler { void handle(Throwable t); }
This gives the option to log the original message / payload when an error occurs.Code:void handle(Message<?> message, Throwable t);
2) Grab the error off the errorChannel
I'd prefer to do this as I am able to write a single error handler that stores the required payload at a single spot, in a single way. I'd expect a similar interface as the ErrorHandler interface and have read (documentation) that it gives ErrorMessages.
Somehow this is not working at my side and I could not simply figure out the way the errorChannel works.
I configured:
the errorMessageHandler is a simple class that implements the MessageHandler interface and thereafter simply logs the whole (it does not do yet what I intented... that is next)Code:<bean id="errorMessageHandler" class="org.joiningtracks.his.support.util.event.LoggingMessageHandler"/> <bean id="ldapMessageErrorHandler" class="org.joiningtracks.his.service.ldap.impl.LdapPatientMessageErrorHandler"/> <!-- configure spring integration context --> <integration:message-bus error-channel="errorChannel"/> <integration:channel id="errorChannel" publish-subscribe="true" capacity="500"/> <integration:handler-endpoint input-channel="errorChannel" handler="errorMessageHandler" error-handler="ldapMessageErrorHandler"> <integration:concurrency core="5" max="25" queue-capacity="20" keep-alive="120"/> </integration:handler-endpoint>
At this moment, I don't see any messages coming, so one question is: what is wrong with this configuration ?
And the other question, does the ErrorMessages give the original payload / message ?


Reply With Quote