I'm trying to understand how errors should be handled in Spring Integration. I found documentation about errorChannel
, I tried to use it but the exception is not caught.
Here is my HTTP outbound gateway:
<int-http:outbound-gateway id="orderRequestHttpGateway"
request-channel="orders-channel"
url="${url}"
http-method="POST"
expected-response-type="java.lang.String"
reply-timeout='5000'
reply-channel='pushed-channel'
charset="UTF-8">
</int-http:outbound-gateway>
I don't understand where I should catch exceptions thrown by this component (like a 500 HTTP error)
The route is started by a poller
. I tried adding an error-channel
property:
<int:inbound-channel-adapter channel="orders-trigger-channel" expression="''">
<int:poller fixed-delay="${poller}" error-channel="errorChannel"/>
</int:inbound-channel-adapter>
I tried with a custom error channel. I also tried to override the existing errorChannel:
<int:channel id="errorChannel"/>
<int:outbound-channel-adapter id="errorChannelHandler"
ref="errorManager"
method="foo"
channel="errorChannel"/>
So far I keep getting MessageHandlingException
and I can't catch them to deal with them properly.