简体   繁体   中英

Restore from dead letter queue

I receive all JMS messages from Queue1 all the time and trying to process it.
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).
How can I achieve that?

You can add a custom property to the message - like RESUBMIT_TIMES, and increment that until 5 is reached. Read this : JMS

if 5 is reached move it to the 5minutesqueue , by setting another property there that has the current timestamp. 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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