Conditional retry
If your error retry logic requires more sophistication than can be expressed by number of retries with delays, then conditional retry can help. It allows you to associate a predicate (expression that evaluates to a boolean
) with an error handler, or onException
block, that is used to decide how long to continue retrying. This gives you much finer control over the number of retry attempts by using any of Camel's Expression Languages, including calling out to a Java method, to decide if it should keep retrying delivery of the message.
This recipe will show you how to use the Simple Expression Language to make a redelivery decision based on the content of the message.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.error.retryconditional
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with retryconditional
.
How to do it...
This example demonstrates the use of the Simple Expression Language to decide...