简体   繁体   English

从死信队列中还原

[英]Restore from dead letter queue

I receive all JMS messages from Queue1 all the time and trying to process it. 我一直都从Queue1接收所有JMS消息,并尝试对其进行处理。
If I tried to process 5 times, and rolled back 5 times, I want ActiveMQ to put the message to a different queue for some period of time (eg 5 minutes). 如果我尝试处理5次并回滚5次,则我希望ActiveMQ在一段时间(例如5分钟)内将消息放入另一个队列。
How can I achieve that? 我该如何实现?

You can add a custom property to the message - like RESUBMIT_TIMES, and increment that until 5 is reached. 您可以将自定义属性添加到消息中,例如RESUBMIT_TIMES,并增加该属性,直到达到5。 Read this : JMS 阅读此: JMS

if 5 is reached move it to the 5minutesqueue , by setting another property there that has the current timestamp. 如果达到5 ,则将其移至5minutesqueue ,方法是在此处设置另一个具有当前时间戳的属性。 For example: 例如:

  message.setStringProperty("TimeOfDispatch", LocalDate.now().toString("yyyy-MM-dd hh:MM:ss"));

Have yet another consumer on the 5minutesqueue that check if 5 minutes have passed(by checking current time with the time from the header) 在5分钟的排队上让另一个消费者检查5分钟是否已经过去(通过使用标头中的时间检查当前时间)

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

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