I have a consumer of a JMS queue. An exception may occur during the consumption, and I need to trigger the process again. I have two preliminary plans:
Set acknowledge to
javax.jms.Session.CLIENT_ACKNOWLEDGE
.javax.jms.Message#acknowledge()
is called to delete the message when processing succeeds, andjavax.jms.Session#recover()
is called to tell OpenMQ to redeliver the message when processing fails. But I couldn't find a way to set the maximum number of redeliveries and the time interval between redeliveries.Set acknowledge to
javax.jms.Session.AUTO_ACKNOWLEDGE
. Send a new message (containing the original message and the processing times) to a new queue each time an exception occurs, and I want to be able to set the delay time. However, I can't find a way to set the delay time of the message.