how to set expiry for ActiveMQ.DLQ queue?

activemq-classic

Solution

Your `deadLetterStrategy` is good and must work fine but you cannot test this like this because the expiration is set by the business code who try to deliver to a consumer and when it fails it sends the message to the DLQ by changing their expiration. you can test by sending a message to any queue you want by setting the `setJMSExpiration` (Time to live) to 1 for example, like this the message will not be delivered and sent directly to the DLQ if `processExpired="true"` .

`ActiveMQ.Advisory.Producer.Queue.ActiveMQ.DLQ` is created because you had a producer who's sent messages to `ActiveMQ.DLQ`. Because you have sent 4 messages to `ActiveMQ.DLQ` you had 8 messages in `ActiveMQ.Advisory.Producer.Queue.ActiveMQ.DLQ` because this topic receive a message when a producer start & another one when it stop messages, this means that your JBOSS FUSE MANAGEMENT CONSOLE creates a connection for sending a message and stops it after that.

Note that by default, ActiveMQ will never expire messages sent to the DLQ, if you want to keep them 7 days you can set `<sharedDeadLetterStrategy expiration="604800000" processExpired="true" processNonPersistent="true" />`

http://activemq.apache.org/advisory-message.html

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

Problem

As a Operation guy (not a developer) and based on http://activemq.apache.org/message-redelivery-and-dlq-handling.html I have tried to set expiry time on the ActiveMQ.DLQ that is integrated into JBoss Fuse 6.2 to ensure that KahaDB's folder wont grow out of disk space but below settings seems do nothing on the queue messages but to copy them over to ActiveMQ.Advisory.Producer.Queue.ActiveMQ.DLQ twice. ``` ... <policyEntry queue=">" producerFlowControl="false"> <deadLetterStrategy> <sharedDeadLetterStrategy expiration="300000"/> </deadLetterStrategy> </policyEntry> ... ``` To test this just sent messages into the ActiveMQ.DLQ queue using JBOSS FUSE MANAGEMENT CONSOLE and noticed a new queue is generated having double the number of messages that I had sent Enqueued: ``` ActiveMQ.Advisory.Producer.Queue.ActiveMQ.DLQ 0 0 0 8 0 0 ActiveMQ.DLQ 4 0 0 4 0 0 ``` Any thought on this?

Original source