7
votes

Can anyone please explain how ActiveMQ Redelivery Policy actually works? Is it working on the client or server side?

Let's say I have a redelivery policy to redeliver a message for up to 10 minutes with an interval of 30 minutes between each attempt, then where exactly the failed message lives?

Assuming that the message failed now and it got to be redelivered after 30 minutes, then where does the message live?

I see that the same consumer gets the message after 30 minutes.

I am wondering where ActiveMQ stores this message for 30 minutes.

If I shut down the consumer or my consumer has crashed, will I be able to recover the message after 30 minutes?

I went thru these ActiveMQ pages for Redelivery Policy and I didn't find any info:

http://activemq.apache.org/redelivery-policy.html http://activemq.apache.org/message-redelivery-and-dlq-handling.html

1

1 Answers

6
votes

There are two types of redelivery. The typical one is the redelivery policy you bind to the ConnectionFactory client side. The broker is not aware of the redelivery in this setup since it's handled by the client, and the message is actually on the client waiting for redelivery. However, since the message is not committed (or Acknowledged) by the client, the broker won't delete it. So, if the message is up for redelivery in 30 minutes, but the client application goes down after 10 minutes, the message will be back visible on the broker.

There is also broker side redelivery via a plugin. In that case, the broker handles redelivery. There are pros and cons, specifically that you can't control it from client code - but the broker admin can control it. This means broker redelivery can redeliver to a different consumer while client side redelivery cannot.

Read more about broker redelivery at the bottom of this page: http://activemq.apache.org/message-redelivery-and-dlq-handling.html