I have a Camel route such as:
<route errorHandlerRef="myDeadLetterErrorHandler">
<from uri="activemq:queue:source"/>
<to uri="activemq:queue:destA">
<to uri="activemq:queue:destB">
<to uri="activemq:queue:destC">
</route>
When one endpoint fail, I set a redeliveryPolicy to retry to send the message some times and if it always fail the message is redelivered to the DeadLetter Queue.
Now I’m looking for a method to send the message from the deadletter queue to the failure endpoint.. does someone have any suggestions?
I was thinking to build a processor that extract the info of the failure endpoint like this:
String lastEndpointUri = exchange.getProperty(Exchange.TO_ENDPOINT, String.class);
And then build some kind of dynamic routing… isn’t there a simpler solution?
Thanks all for the answers, I have quickly resolved the problem putting endpoints in a separate routing and setting the same redeliveryPolicy to eachone.
In this way the message will always be delivered to every endpoint also if one fail and when the failure endpoint will come back the messages will be redelivered.
I think that the solution proposed by boday is correct and probably I’ll try that one in the future.
I’ve also discovered that if the total message order is not important we can use also “Broker Redelivery” that use a special queue to redeliver each message.
http://activemq.apache.org/message-redelivery-and-dlq-handling.html