Hi Naruda, Camel RedeliveryPolicy is suitable only for short delayed retries (couple of ms to couple of seconds) as it is all in Camel app memory. IMHO you should consider the following two options:
1. Recently I had to implement long delayed redeliveries/retries with 5-10 minute delays in Camel. For that I have used ActiveMQ scheduller [1]. The idea is, if you want to retry a message after 15 minutes, you can send that message to queue by setting AMQ_SCHEDULED_DELAY header and a counter. Then the message will be persisted in the broker and be available for consumption after 15 minutes. The you can check the counter and retry the opration, and if it fails reshedulle it again by increasing the counter. This is kind of manual redelivery mechanism which relies on ActiveMQ for the delays. A benefit of this approach is that the messages are persisted in the rather than the Camel app memory, and you can also use competing consumers an retry the same message in a different Camel consumer. 2. Notice that the same broker persisted redelivery is also provided OOTB by ActiveMQ Broker Redelivery Plugin [2]. That plugin can intercept a message that is send to DLQ and schedulle it for redelivery to the original queue after fixed time perfiod. Keep in mind that 1 and 2 are different that [3] which is another redelivery mechanism offered by ActiveMQ consumer. ActiveMQ consumer can also redelivery your message to the Camel route, but it has similar limitation as the Camel RedeliveryPolicy where the message is not persisted and all in memory. I have documented the use cases above in Retry Pattern Chapter of my recently published Camel Design Patterns book [4]. I suggest you go with 1 or 2 for such long delayed redeliveries. [1] http://activemq.apache.org/delay-and-schedule-message-delivery.html [2] http://activemq.apache.org/message-redelivery-and-dlq-handling.html [3] http://activemq.apache.org/message-redelivery-and-dlq-handling.html [4] http://www.ofbizian.com/2016/01/camel-design-patterns-ebook-is-out.html HTH, Bilgin On 27 January 2016 at 13:31, Naruda <nevin2...@gmail.com> wrote: > Hi, > > I currently have Camel setup with a dead letter channels for each of my > queues and a redelivery policy that retires 3 times once every 15 minutes. > > The problem I'm having is that if I shutdown the Camel context I lose those > inflight messages, unless I specify a large graceful shutdown period. > > Is there anyway to tell to put inlfight messages onto the dead letter during > a shutdown or back on the original queue? > > Thanks > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Handling-inflight-messages-during-shutdown-tp5776814.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Bilgin Ibryam Camel Committer at ASF & Integration Architect at Red Hat Blog: http://ofbizian.com | Twitter: @bibryam Camel Design Patterns https://leanpub.com/camel-design-patterns Instant Apache Camel Message Routing http://www.amazon.com/dp/1783283475