Reputation: 7335
I have a Camel Application which makes a call to a RESTFul service.
I expose a RESTful and a SOAP interface to my clients
Both the RESTful and the SOAP routes end up calling a common route which actually makes the call to the RESTFul service.
So, it s little like
<camel:route>
<camel:from uri="RESTFUL_INTERFACE" />
<camel:to uri="direct:CALLEXTERNAL_REST_SERVICE" />
<camel:to uri="ADAPT_RESPONSE" />
</camel:route>
<camel:route>
<camel:from uri="SOAP_INTERFACE" />
<camel:to uri="direct:CALLEXTERNAL_REST_SERVICE" />
<camel:to uri="ADAPT_RESPONSE" />
</camel:route>
<camel:route>
<camel:from uri="direct:CALLEXTERNAL_REST_SERVICE" />
<camel:to uri="EXTERNAL_RESTFUL_SERVICE" />
</camel:route>
If my call to EXTERNAL_REST_SERVICE fails ( Connection refused for example ), then I need to take different actions in my REST and SOAP routes. As far as I can tell, onException
applies only to the route it is specifed in.
How do I communicate the failure in direct:CALLEXTERNAL_REST_SERVICE
back to the "outer" routes?
Upvotes: 0
Views: 180
Reputation: 820
You can have an onException for your camel context (this will be applied to all routes within). From there, onException is simply just another route. You can have a CBR, for example, and specify what to do next, based on where the exception occurred.
Upvotes: 1