com.ibm.mq.jms
Class MQQueueBrowser

java.lang.Object
  |
  +--com.ibm.mq.jms.MQQueueBrowser
All Implemented Interfaces:
javax.jms.QueueBrowser

public class MQQueueBrowser
extends java.lang.Object
implements javax.jms.QueueBrowser

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

Note that the WebSphere MQ class MQQueueEnumeration is used to hold the browse cursor.


Method Summary
 void close()
          Closes all open queues left in enumerated objects.
 java.util.Enumeration getEnumeration()
          Gets an enumeration for browsing the current queue messages in the order that they are received.
 java.lang.String getMessageSelector()
          Gets the queue browser's message selector expression.
 javax.jms.Queue getQueue()
          Gets the queue associated with this queue browser.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getQueue

public javax.jms.Queue getQueue()
                         throws javax.jms.JMSException
Gets the queue associated with this queue browser.

Specified by:
getQueue in interface javax.jms.QueueBrowser
Returns:
the queue
Throws:
javax.jms.JMSException - if JMS fails to get the queue associated with this browser due to some JMS error.

getMessageSelector

public java.lang.String getMessageSelector()
                                    throws javax.jms.JMSException
Gets the queue browser's message selector expression.

Specified by:
getMessageSelector in interface javax.jms.QueueBrowser
Returns:
this queue browser's message selector
Throws:
javax.jms.JMSException - if JMS fails to get the message selector for this browser due to some JMS error.

getEnumeration

public java.util.Enumeration getEnumeration()
                                     throws javax.jms.JMSException
Gets an enumeration for browsing the current queue messages in the order that they are received.

Note that if the browser is created for a nonexistent queue, this is not detected until the first call to getEnumeration.

Specified by:
getEnumeration in interface javax.jms.QueueBrowser
Returns:
an enumeration for browsing the messages.
Throws:
javax.jms.JMSException - if JMS fails to get the enumeration for this browser because of a JMS error.

close

public void close()
           throws javax.jms.JMSException
Closes all open queues left in enumerated objects. Because a provider can allocate some resources outside the JVM on behalf of an MQQueueBrowser, clients must close them when they are not needed. You cannot rely on garbage collection to reclaim these resources eventually, because this might not occur soon enough.

Specified by:
close in interface javax.jms.QueueBrowser
Throws:
javax.jms.JMSException - if JMS fails to close this browser because of a JMS error.

(c) Copyright IBM Corp. 2005. All Rights Reserved.