Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removed the deprecated Camel 1.x documentations

...

  • 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.

...

Handled on Dead Letter Channel was introduced in Camel 2.0, this feature does not exist in Camel 1.x

When all attempts of redelivery have failed the Exchange is moved to the dead letter queue (the dead letter endpoint). The exchange is then complete and from the client point of view it was processed. As such the Dead Letter Channel have handled the Exchange.

...

About moving Exchange to dead letter queue and using the original message

...

The option useOriginalMessage is used for routing the original input message instead of the current message that potentially is modified during routing.

...

Then the messages routed to the jms:queue:dead is the original input. If we want to manually retry we can move the JMS message from the failed to the input queue, with no problem as the message is the same as the original we received.

OnRedelivery

...

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 We also 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

In Camel 2.0 redelivery Redelivery is disabled by default, as opposed to Camel 1.x in which Dead Letter Channel is configured with maximumRedeliveries=5.

The default redeliver policy will use the following values:

  • maximumRedeliveries=0 (in Camel 1.x the default value is 5)
  • redeliverDelay=1000L (1 second, new as of Camel 2.0)use initialRedeliveryDelay for previous versions
  • maximumRedeliveryDelay = 60 * 1000L (60 seconds)
  • And the exponential backoff and collision avoidance is turned off.
  • The retriesExhaustedLogLevel are set to LoggingLevel.ERROR
  • The retryAttemptedLogLevel are set to LoggingLevel.DEBUG
  • Stack traces is logged for exhausted messages from Camel 2.2 onwards.
  • Handled exceptions is not logged from Camel 2.3 onwards

...

Camel will log delivery failures at the DEBUG logging level by default. You can change this by specifying retriesExhaustedLogLevel and/or retryAttemptedLogLevel. See ExceptionBuilderWithRetryLoggingLevelSetTest for an example.

In Camel 2.0 you You can turn logging of stack traces on/off. If turned off Camel will still log the redelivery attempt. Its just much less verbose.

Redeliver Delay Pattern

...

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).

...

When a message is redelivered the DeadLetterChannel will append a customizable header to the message to indicate how many times its been redelivered.
In Camel 1.x: The header is org.apache.camel.redeliveryCount.
In Before Camel 2.06: The header is CamelRedeliveryCounter, which is also defined on the Exchange.REDELIVERY_COUNTER.
In Camel Starting with 2.6: The header CamelRedeliveryMaxCounter, which is also defined on the Exchange.REDELIVERY_MAX_COUNTER, contains the maximum redelivery setting. This header is absent if you use retryWhile or have unlimited maximum redelivery configured.

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, which is also defined on the Exchange.REDELIVERED.

...

How can I modify the Exchange before redelivery?

In Camel 1.6.0 we added We support directly in Dead Letter Channel to set a Processor that is executed before each redelivery attempt.

...