Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveMQ Redelivery Policy - How does it work?

Tags:

jms

activemq

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

like image 920
serverfaces Avatar asked Apr 17 '15 03:04

serverfaces


People also ask

Does ActiveMQ guarantee order?

ActiveMQ will preserve the order of messages sent by a single producer to all consumers on a topic. If there is a single consumer on a queue then the order of messages sent by a single producer will be preserved as well.

How do I process messages in dead letter queue ActiveMQ?

The default Dead Letter Queue in ActiveMQ is called ActiveMQ. DLQ ; all un-deliverable messages will get sent to this queue and this can be difficult to manage. So, you can set an individualDeadLetterStrategy in the destination policy map of the activemq.

What is ActiveMQ and how it works?

Written in Java, ActiveMQ translates messages from sender to receiver. It can connect multiple clients and servers and allows messages to be held in queue, instead of requiring both the client and server to be available simultaneously in order to communicate.

How does ActiveMQ store messages?

The AMQ message store directory structure. When you start ActiveMQ with the AMQ message store configured, a directory will automatically be created in which the persistent messages are held. The AMQ message store directory contains subdirectories for all the brokers that are running on the machine.


1 Answers

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

like image 126
Petter Nordlander Avatar answered Oct 10 '22 11:10

Petter Nordlander