简体   繁体   English

重新传递策略后如何阻止邮件进入Activemq中的Dead LetterQueue(DLQ)

[英]How to stop messages from going to Dead LetterQueue(DLQ) in Activemq after re-delivery policy

private BrokerService createBroker() throws IOException, Exception {
         BrokerService broker = new BrokerService();KahaDBStore kaha=new KahaDBStore();
         File file =new File(path);
         TransportConnector connector = new TransportConnector();
         connector.setUri(new URI(DEFAULT_BROKER_URL));
         kaha.setDirectory(file);
         broker.addConnector(connector);
         broker.setPersistenceAdapter(kaha);
}

This is configuration for my broker. 这是我的经纪人的配置。 Can somebody specify the configuration, how I can stop messages from going to DLQ after my re-delivery policy? 有人可以指定配置吗,重新发送策略后如何阻止邮件发送到DLQ?

Note : I have already visited this, http://activemq.apache.org/message-redelivery-and-dlq-handling.html 注意:我已经访问了此站点http://activemq.apache.org/message-redelivery-and-dlq-handling.html

The question is - what do you want to do with them instead? 问题是-您想与他们做什么?

Just drop them after all redelivery attempts has been exhausted? 在所有重新交付尝试都用尽之后,只需丢弃它们?

Configure the discard plugin 配置丢弃插件

<deadLetterStrategy>
   <discarding/>
</deadLetterStrategy>

or by Java 或通过Java

PolicyEntry policy = new PolicyEntry();
policy.setDeadLetterStrategy(new DiscardingDeadLetterStrategy());
PolicyMap policyMap = new PolicyMap();
policyMap.setDefaultEntry(policy);
broker.setDestinationPolicy(policyMap);

Never exhaust redelivery and try until the message is through? 切勿耗尽重新交付的机会,并尝试直到消息通过为止?

This may be problematic beacuse of poision messages - ie messages with corrupt payload that never can be processed and has to be removed to not interrupt the flow. 这可能是由于消息的准确性而引起的问题,即消息的有效载荷已损坏,这些消息永远无法处理,必须删除才能不中断流程。 If you want this anyway, configure a client side maximumRedelivery to -1 ( see docs ). 如果仍maximumRedelivery ,请将客户端的maximumRedelivery配置为-1( 请参阅docs )。

You can use: 您可以使用:

RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
redeliveryPolicy.setMaximumRedeliveries(-1);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM