|
|
Chain/Gateway error handling
I have a chain that uses gateways to call other chains and I want to ensure that if one gateway call fails from an error the other items in the chain still execute.
Here is my current configuration:
Code:lt;gateway id=quot;profileGatewayquot;
service-interface=quot;someInterfacequot;
error-channel=quot;profileHmkFailureChannelquot;gt; lt;!-- global catch --gt;
lt;method name=quot;loginquot; request-channel=quot;profileServicesInputChannelquot;
reply-channel=quot;profileServicesOutputChannelquot;
reply-timeout=quot;40quot;
request-timeout=quot;40quot;/gt;
lt;/gatewaygt;
lt;!-- ROOT CHAIN --gt;
lt;chain input-channel=quot;profileServicesInputChannelquot; output-channel=quot;profileServicesOutputChannelquot;gt;
lt;header-enrichergt;
lt;header name=quot;profilequot; ref=quot;profilequot;/gt;
lt;error-channel ref=quot;profileHmkFailureChannelquot;/gt;
lt;/header-enrichergt;
lt;transformer method=quot;transformquot; ref=quot;profileToHmkUserTransformerquot;/gt;
lt;gateway request-channel=quot;profileHmkInputChannelquot; request-timeout=quot;10quot;/gt;
lt;transformer method=quot;transformquot; ref=quot;profileToHmkOrgTransformerquot;/gt;
lt;gateway request-channel=quot;profileHmkOrgInputChannelquot; request-timeout=quot;10quot;/gt;
lt;transformer method=quot;transformquot; ref=quot;profileToAcsTransformerquot;/gt;
lt;gateway request-channel=quot;profileAcsInputChannelquot; request-timeout=quot;10quot;/gt;
lt;/chaingt;
lt;!-- START - Info --gt;
lt;chain input-channel=quot;profileHmkInputChannelquot;gt;
lt;header-enrichergt;
lt;error-channel ref=quot;profileHmkFailureChannelquot;/gt;
lt;/header-enrichergt;
lt;service-activator method=quot;getUserquot; ref=quot;hmkUserServicequot;/gt;
lt;transformer expression=quot;@profileHmkTransform.transform(payload, headers.profile)quot;/gt;
lt;/chaingt;
As you can see I've tried using the header-enricher in both places but it never seems to get called. I am able to catch the error (caused in service-activator ref=hmkUserService) at the profileGateway but by that time it is too late and the error has causes the chain to exit.
My questions are:
1) Is there a way to tell the 'root' chain to keep going even if there is an exception in one of the gateway calls?
2) Is there a way to have each gateway send errors to their own error-channels (the header-enricher doesn't seem to be working)
3) Could I be doing this a better way?
Thanks in advance!
Ok, the issue is that we need to allow error-channel on the lt;gatewaygt; element within the chain.
Could you please open a JIRA issue for that?
Thanks
Ok I created a JIRA browse/INT-1745
Should be ready for 2.0.2 |
|