Reputation: 51
I am interested in using RedeliveryPolicy in Camel to retry redelivery of a message to an endpoint when a certain exception is returned. But I cannot seem to find many examples of how to configure it.
At the moment I am trying:
from("direct:entry")
.onException(ResourceNotFoundException.class)
.redeliveryPolicy(new RedeliveryPolicy().delayPattern("delayPattern=0:" + aocmDelay + ",10:1000;15:2000:19:10000"))
.handled(true)
.end()
.to("direct:destination");
I have the destination endpoint failing with a ResourceNotFoundException but the onException handling is not being called and the redelivery does not take effect. Any ideas of what I am doing wrong?
Upvotes: 2
Views: 4840
Reputation: 22973
You need to set the single properties of a redelivery policy.
from("direct:entry")
.onException(ResourceNotFoundException.class)
.maximumRedeliveries(20)
.delayPattern("1:2000;10:1000;15:2000;19:10000")
.handled(true)
.end()
.to("direct:destination");
Additional comments:
delayPattern=0:" + aocmDelay + ",10:1000;15:2000:19:10000
________________________________;_______________;________
1
, if you define 0:1000;1:5000
the first redelivery is delayed by five seconds not by oneUpvotes: 5