是否可以为各个队列设置死信队列 [英] Is it possible to have dead letter queue for individual queues
问题描述
我目前在ActiveMQ服务器中有一个名为 hello.world
的队列。每当消息处理失败时,ActiveMQ都会创建一个默认目录,名为 ActiveMQ.DLQ
。是否可以将该名称更改为 hello.world.DLQ
之类的名称?原因是将来我可能会有几个队列,并且希望它像< queue_name> .DLQ
I currently have a Queue in my ActiveMQ server called hello.world
. Whenever a message fails to be processed, ActiveMQ creates a default directory called ActiveMQ.DLQ
. Is it possible to change that name to something like hello.world.DLQ
? The reason being is that I might have several queues in the future and I want it to be something like <queue_name>.DLQ
推荐答案
在此过程中,您要查找的东西称为个人死信队列策略
,
ActiveMQ为每个队列/主题创建特定的DLQ,
The thing you are looking for is called Individual Dead letter Queue strategy
,
in this process ActiveMQ creates specific DLQ for each queue/topic,
您可以通过调整 activemq.xml
来实现以下目标
you can implement it as follows, by tweaking your activemq.xml
a bit
<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>
此配置将创建名称为 DLQ的DLQ。< queue_name>
,如果不希望使用前缀,则可以删除 queuePrefix
属性。
this configuration will create DLQ with names like DLQ.<queue_name>
, if you do not want the prefix , you can remove queuePrefix
attribute.
希望
祝你好运!
这篇关于是否可以为各个队列设置死信队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!