Is it possible to have dead letter queue for individual queues

心已入冬 提交于 2019-12-02 01:06:44

问题


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


回答1:


The thing you are looking for is called Individual Dead letter Queue strategy, in this process ActiveMQ creates specific DLQ for each queue/topic,

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>

this configuration will create DLQ with names like DLQ.<queue_name> , if you do not want the prefix , you can remove queuePrefix attribute.

hope this helps!

Good luck!



来源:https://stackoverflow.com/questions/31149534/is-it-possible-to-have-dead-letter-queue-for-individual-queues

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!