ActiveMQ 5.1.5:individualDeadLetterStrategy 未按预期工作

ActiveMQ 5.1.5: individualDeadLetterStrategy not working as expected

我正在尝试根据以下配置为每个队列配置一个 DLQ 如所述 here:

<!-- Set the following policy on all queues using the '>' wildcard -->
<policyEntry queue=">">
   <deadLetterStrategy>
      <!--
         Use the suffix 'DLQ.' for the destination name, and make
         the DLQ a queue rather than a topic
      -->
      <individualDeadLetterStrategy queueSuffix=".DLQ" useQueueForQueueMessages="true"/>
   </deadLetterStrategy>
</policyEntry>

我正在使用虚拟主题,所以有一个名为

的主题

VirtualTopic.Things.1.0

这意味着我可以创建一个名为

的队列

Consumer.Me.VirtualTopic.Things.1.0

自动订阅此主题。

上面的 individualDeadLetterStrategy 创建了一个名称为:

的 DLQ

ActiveMQ.DLQ.Queue.Consumer.Me.VirtualTopic.Things.1.0.DLQ

我只是希望

Consumer.Me.VirtualTopic.Things.1.0.DLQ

我的期望是否正确?我是不是做错了什么?

默认queuePrefixActiveMQ.DLQ.Queue.,默认queueSuffix为空。由于您使用的是 queueSuffix=".DLQ" 而未定义 queuePrefix,因此它会创建具有默认前缀和您的自定义后缀的队列,从而导致 ActiveMQ.DLQ.Queue.<queueName>.DLQ。如果您不想使用默认前缀,您应该设置 queuePrefix="",例如:

<individualDeadLetterStrategy queuePrefix="" queueSuffix=".DLQ" useQueueForQueueMessages="true"/>