how to consult the elements of a JMS queue without deleting them

74 Views Asked by At

Good morning, I have a queue in a wso2 message broker. I would like to know if in java there is a way to be able to consult the elements of a queue without deleting them. I tried to use the QueueBrowser but the application goes me wrong (my question --> JMS: Server closed connection and reconnection not permitted). The connection is correct because if I create a consumer it works for me I wanted to know if you knew another way.

Thank you.

1

There are 1 best solutions below

0
On

It should work and looking at your code in the linked question it seems correct. A very dirty approach is to actually read the messages within a transaction and rollback when done. Transactions are not always supported, though, and regardless reading and rolling back is expensive, so I would only do that as a last resort.