Camel will log delivery failures at the ERROR logging level by default. You can change this by specifying retriesExhaustedLogLevel and/or retryAttemptedLogLevel. See ExceptionBuilderWithRetryLoggingLevelSetTest for an example.
Redeliver Delay Pattern
Available as of Camel 2.0
Delay pattern is used as a single option to set a range pattern for delays. If used then the following options does not apply: (delay, backOffMultiplier, useExponentialBackOff, useCollisionAvoidance, maximumRedeliveryDelay).
The idea is to set groups of ranges using the following syntax:
limit:delay;limit 2:delay 2;limit 3:delay 3;...;limit N:delay N
Each group has two values separated with colon
- limit = upper limit
- delay = delay in millis
And the groups is again separated with semi colon.
The rule of thumb is that the next groups should have a higher limit than the previous group.
Lets clarify this with an example:
That gives us 3 groups:
Resulting in these delays for redelivery attempt:
- Attempt number 0..4 = 0 millis (as the first group start with 5)
- Attempt number 5..9 = 1000 millis (the first group)
- Attempt number 10..19 = 5000 millis (the second group)
- Attempt number 20.. = 20000 millis (the last group)
You can start a group with limit 0 to eg have a starting delay:
- Attempt number 0..4 = 1000 millis (the first group)
- Attempt number 5.. = 5000 millis (the last group)
There is no requirement that the next delay should be higher than the previous. You can use any delay value you like. For example with
delayPattern=0:5000;3:1000 we start with 5 sec delay and then later reduce that to 1 second.
When a message is redelivered the DeadLetterChannel will append a customizable header to the message to indicate how many times its been redelivered. The default value is org.apache.camel.redeliveryCount.
The header org.apache.camel.Redelivered contains a boolean if the message is redelivered or not.