To determine where to send exception messages, you need to set the "errorChannel" header. For instance,
<int:chain input-channel="myInputChannel"> <int:header-enricher> <int:error-channel ref="myErrorChannel" /> </int:header-enricher> <int:transformer ref="myTransformer" /> </int:chain>
This chain will assign an error channel header before calling the transformer. If the transformer succeeds, it continues to move along the chain, but if it throws an exception, then a MessagingException will be sent as a message to myErrorChannel. (If you want the method for handling the exception to be different later in the chain, you could enrich the header again after the transformer has updated the errorChannel header to the next place you want to send the exceptions.)
Refer to the Error Handling section of the Spring Integration documentation for details.
source share