Is it possible to have a queue of dead letters for individual queues
I currently have a queue on my ActiveMQ server named hello.world
. Whenever a message is not processed, ActiveMQ creates a default directory ActiveMQ.DLQ
. Is it possible to change this name to something like hello.world.DLQ
? The reason is that in the future I might have multiple queues and I want it to be something like<queue_name>.DLQ
source to share
The thing you are looking for is called Individual Dead letter Queue strategy
, in this process ActiveMQ creates a specific DLQ for each queue / topic,
you can implement it like this: by changing slightly activemq.xml
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry queue=">"> <!-- '>' is the wildcard used in ActiveMQ which means for all queues, i.e. same as '*' in any other language -->
<!-- need to add the following lines in you conf file -->
<deadLetterStrategy>
<individualDeadLetterStrategy
queuePrefix="DLQ." useQueueForQueueMessages="true" />
</deadLetterStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
this config will create DLQ with type names DLQ.<queue_name>
, if you don't want a prefix you can remove the attribute queuePrefix
.
hope this helps!
Good luck!
source to share