Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • how many times a message is attempted to be redelivered before it is considered a failure and sent to the dead letter channel
  • the initial redelivery timeout
  • whether or not exponential backoff is used (i.e. the time between retries increases using a backoff multiplier)
  • whether to use collision avoidance to add some randomness to the timings
  • delay pattern a new option in Camel 2.0, see below for details.

Once all attempts at redelivering the message fails then the message is forwarded to the dead letter queue.

...

When Dead Letter Channel is doing redeliver its possible to configure a Processor that is executed just before every redelivery attempt. This can be used for the situations where you need to alter the message before its redelivered. See below for sample.

Tip
titleonException and onRedeliver

In Camel 2.0 we also added support for per onException to set a onRedeliver. That means you can do special on redelivery for different exceptions, as opposed to onRedelivery set on Dead Letter Channel can be viewed as a global scope.

Redelivery default values

...

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
In Camel 1.x: The header is org.apache.camel.redeliveryCount.
In Camel 2.0: The header is CamelRedeliveryCount.

And a boolean flag whether it is being redelivered or not (first attempt)
In Camel 1.x: The header org.apache.camel.Redelivered contains a boolean if the message is redelivered or not.

...

In Camel 2.0: The header CamelRedelivered contains a boolean if the message is redelivered or not.

Samples

The following example shows how to configure the Dead Letter Channel configuration using the DSL

...

Wiki Markup
{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/InterceptAlterMessageBeforeRedeliveryTest.java}
Info
titleCode uses wrong header key

As the code above is based on an unit test its based on Camel 2.x or newer. The header to use in Camel 1.x should be "org.apache.camel.redeliveryCount" instead of "CamelRedeliveryCount".

However you should notice as Camel will keep the redeliver flag on the Exchange for the remainder of its routing this interceptor will kick in for subsequence processing. So you should keep track if you already have altered the message before redelivery.

...