Reputation: 2045
My camel context sample.
<camel:camelContext>
<camel:route id="r1">
<camel:from="someEndpoint"/>
...
<camel:to="to2"/>
</camel:route>
<camel:route id="r2">
<camel:from="to2"/>
...
<camel:to="to3"/>
</camel:route>
<camel:route id="r3">
<camel:from="to3"/>
...
<camel:to="to4"/>
</camel:route>
<camel:route id="r4">
<camel:from="to4"/>
...
<camel:to="exit"/>
</camel:route>
<camel:route id="errorProcessorRoute">
<camel:from="???"/>
...Some action...
<camel:to="exit"/>
</camel:route>
</camel:camelContext>
I need if any error occure than procces route -> errorProcessorRoute.
How to implement it?
Upvotes: 1
Views: 3911
Reputation: 26
If you want to catch any error you could use the onException tag
<camel:camelContext>
....
<camel:route id="errorProcessorRoute">
<camel:from="direct:foo"/>
...Some action...
<camel:to="exit"/>
</camel:route>
<onException>
<exception>java.lang.Exception</exception>
<to uri="direct:foo"/>
</onException>
</camel:camelContext>
Upvotes: 1
Reputation: 15318
<camel:errorHandler id="deadLetterErrorHandler" type="DeadLetterChannel" deadLetterUri="log:dead">
<camel:redeliveryPolicy maximumRedeliveries="2" redeliveryDelay="1000" logHandled="true" asyncDelayedRedelivery="true"/>
</camel:errorHandler>
From here.
Upvotes: 1