Retrying an operation
Sometimes the best way to fix an error that was triggered when invoking a service is to try sending it again, as the backend infrastructure may be temporarily unavailable. Camel makes it easy to specify policies that automatically retry making calls before flagging a message as an error. This recipe will show some of the ways in which you can control the retry policies for your integration routes.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.error.retry
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with retry
.
How to do it...
In the XML DSL, define an errorHandler
element within the camelContext
element, and reference its id
with the camelContext ...
Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.