문제

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?

도움이 되었습니까?

해결책

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)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top