Problem Statement
Continuing on the problem described in my previous post I wanted that once an exception occurs in my route, instead of trying to poll the request again, the route should sleep for a while say half an hour. This would give sufficient time for servers to stabalize and avoid unnecessary polling.Issue
I used camel redeliveryPolicy to do this. Since i wanted that the request be polled until it was successfully process and not for some predefined max retries, I specified only redeliveryDelay.
<camel:onException>
<camel:exception>java.lang.Exception</camel:exception>
<camel:redeliveryPolicy redeliveryDelay="50000" />
<camel:log message="Default error handler was called"></camel:log>
</camel:onException>
Even though onException was getting invoked delay was not taking effect.
Solution
On my colleague's advice i added maximumRedeliveries tag as well and finally delay took effect. Code snapshot that worked below:
<camel:onException>
<camel:exception>java.lang.Exception</camel:exception>
<camel:redeliveryPolicy maximumRedeliveries="1" redeliveryDelay="50000" />
<camel:log message="Default error handler was called"></camel:log>
</camel:onException>
So seems like in redeliveryPolicy, maximumRedeliveries and redeliveryDelay go hand in hand.