简体   繁体   English

ActiveMQ将过期的邮件移到与失败的邮件不同的队列中

[英]ActiveMQ move expired messages to different queue than failed messages

I have a use case where there may be a build up of messages on an ActiveMQ queue. 我有一个用例,其中可能在ActiveMQ队列上堆积了消息。 The goal is to have higher priority, newer messages executed first. 目标是拥有更高的优先级,首先执行更新的消息。 High priority messages older than some time should be executed at a lower priority. 早于某个时间的高优先级消息应以较低的优先级执行。

From what I have read, the JMS selector does not support a concept of NOW(); 据我所读,JMS选择器不支持NOW()的概念。 (ie) (即)

JMSTimestamp < NOW() - 30 MINUTES

I read a suggestion to use expire time. 我阅读了有关使用到期时间的建议。 From my understanding of the redelivery policy , expired messages go to the same queue as failed messages. 据我对重新交付策略的了解,过期的消息与失败的消息进入同一队列。 Is there a way to have expired messages move to a different queue (queue.A) then failed messages (DLQ)? 有没有办法将过期的邮件移动到与失败的邮件(DLQ)不同的队列(队列A)?

Thanks. 谢谢。

In ActiveMQ 5.x there isn't a way that I can think to do this using the standard set of broker configuration options. 在ActiveMQ 5.x中,没有一种方法可以想到使用标准的代理配置选项集来实现。 That said you could always write your own BrokerPlugin that does something along these lines by intercepting expired messages and sending them off someplace else. 也就是说,您始终可以编写自己的BrokerPlugin,通过拦截过期的消息并将其发送到其他地方来执行这些操作。

If you are using ActiveMQ Artemis then you can do this quite easily by configuring it to do what you want, the Failed Delivery and Expiry address configurations allow you do handle this scenario. 如果您使用的是ActiveMQ Artemis,则可以通过将其配置为执行所需的操作来轻松完成此操作,“ 失败的传递”和“ 到期”地址配置允许您处理这种情况。

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

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