How to unacknowledge a message and send it back to the queue in JMS?

280 views Asked by At

Using JMS once I read/consume a message from queue I want to redeliver the same message back to queue because I want to stop processing for a while. How can this be achieved?

1

There are 1 answers

2
Justin Bertram On

To cancel unacknowledged messages back to the queue you can simply close your JMS consumer. If you're using AUTO_ACKNOWLEDGE mode on your JMS session you won't be able to cancel the messages back to the queue as they'll be acknowledged automatically.

If you're using a transacted JMS session you can simply call rollback() on the session.