Question

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 (e.g. 5 minutes).
How can I achieve that?

Was it helpful?

Solution

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top