Dead Letter ChannelCamel supports the Dead Letter Channel RedeliveryIt is common for a temporary outage or database deadlock to cause a message to fail to process; but the chances are if its tried a few more times with some time delay then it will complete fine. So we typically wish to use some kind of redelivery policy to decide how many times to try redeliver a message and how long to wait before redelivery attempts. The RedeliveryPolicy
Once all attempts at redelivering the message fails then the message is forwarded to the dead letter queue. Redelivery headerWhen a message is redelivered the DeadLetterChannel Configuring via the DSLThe following example shows how to configure the Dead Letter Channel configuration using the DSL RouteBuilder<Exchange> builder = new RouteBuilder<Exchange>() { public void configure() { errorHandler(deadLetterChannel("queue:errors")); from("queue:a").to("queue:b"); } }; You can also configure the RedeliveryPolicy RouteBuilder<Exchange> builder = new RouteBuilder<Exchange>() { public void configure() { errorHandler(deadLetterChannel("queue:errors").maximumRedeliveries(2).useExponentialBackOff()); from("queue:a").to("queue:b"); } }; Using This PatternIf you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. |