JMS 1.0.2

javax.jms
Interface QueueBrowser


public interface QueueBrowser

A client uses a QueueBrowser to look at messages on a queue without removing them.

The browse methods return a java.util.Enumeration that is used to scan the queue's messages. It may be an enumeration of the entire content of a queue or it may only contain the messages matching a message selector.

Messages may be arriving and expiring while the scan is done. JMS does not require the content of an enumeration to be a static snapshot of queue content. Whether these changes are visible or not depends on the JMS provider.

Version:
1.0 - 13 August 1998
Author:
Mark Hapner, Rich Burridge
See Also:
QueueSession.createBrowser(Queue), QueueSession.createBrowser(Queue, String), QueueReceiver

Method Summary
 void close()
          Since a provider may allocate some resources on behalf of a QueueBrowser outside the JVM, clients should close them when they are not needed.
 java.util.Enumeration getEnumeration()
          Get an enumeration for browsing the current queue messages in the order they would be received.
 java.lang.String getMessageSelector()
          Get this queue browser's message selector expression.
 Queue getQueue()
          Get the queue associated with this queue browser.
 

Method Detail

getQueue

public Queue getQueue()
               throws JMSException
Get the queue associated with this queue browser.
Returns:
the queue
Throws:
JMSException - if JMS fails to get the queue associated with this Browser due to some JMS error.

getMessageSelector

public java.lang.String getMessageSelector()
                                    throws JMSException
Get this queue browser's message selector expression.
Returns:
this queue browser's message selector
Throws:
JMSException - if JMS fails to get the message selector for this browser due to some JMS error.

getEnumeration

public java.util.Enumeration getEnumeration()
                                     throws JMSException
Get an enumeration for browsing the current queue messages in the order they would be received.
Returns:
an enumeration for browsing the messages
Throws:
JMSException - if JMS fails to get the enumeration for this browser due to some JMS error.

close

public void close()
           throws JMSException
Since a provider may allocate some resources on behalf of a QueueBrowser outside the JVM, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.
Throws:
JMSException - if a JMS fails to close this Browser due to some JMS error.

JMS 1.0.2

JMS 1.0.2