Browsing Messages

If the
destination from which you are consuming messages is a point-to-point queue,
you can use a queue
browser to examine the messages in the queue without consuming
them. The session method createBrowser creates a browser for a specified
queue:

QueueBrowser myBrowser = mySession.createBrowser(myDest);

The method will throw an exception (InvalidDestinationException) if you try to
pass it a topic destination instead of a queue. You can also supply a selector string as an optional second argument: