Robertone
Robertone

Reputation: 7

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

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.

Upvotes: 0

Views: 65

Answers (1)

ewramner
ewramner

Reputation: 6233

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.

Upvotes: 0

Related Questions