Class MQQueueBrowser
- All Implemented Interfaces:
JmsPropertyContext, JmsQueueBrowser, JmsReadablePropertyContext, Serializable, AutoCloseable, Map<String,Object>, javax.jms.QueueBrowser
Note that the IBM MQ extensions class MQQueueEnumeration is used
to hold the browse cursor. This means that each instance of this class will have one open handle
to the underlying queue on which the MQQueueBrowser is created. These open queues get closed only
when the close() method of MQQueueBrowser is called or when the queue does not have any more
messages ( either when MQQueueEnumeration.hasMoreElements() returns false, or
MQQueueEnumeration.nextElement() throws a NoSuchElementException ).
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes all open queues left in enumerated objects.Enumeration<?> Gets an enumeration for browsing the current queue messages in the order that they are received.Gets the queue browser's message selector expression.javax.jms.QueuegetQueue()Gets an enumeration for browsing the current queue messages in the order that they are received.Methods inherited from class MQRoot
clear, containsKey, containsValue, entrySet, equals, get, getBooleanProperty, getByteProperty, getBytesProperty, getCharProperty, getDoubleProperty, getFloatProperty, getIntProperty, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, hashCode, isEmpty, keySet, propertyExists, put, putAll, remove, setBatchProperties, setBooleanProperty, setByteProperty, setBytesProperty, setCharProperty, setDoubleProperty, setFloatProperty, setIntProperty, setLongProperty, setObjectProperty, setShortProperty, setStringProperty, size, valuesMethods inherited from interface JmsPropertyContext
setBatchProperties, setBooleanProperty, setByteProperty, setBytesProperty, setCharProperty, setDoubleProperty, setFloatProperty, setIntProperty, setLongProperty, setObjectProperty, setShortProperty, setStringProperty, toJsonMethods inherited from interface JmsReadablePropertyContext
getBooleanProperty, getByteProperty, getBytesProperty, getCharProperty, getDoubleProperty, getFloatProperty, getIntProperty, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, stringifyMeMethods inherited from interface Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
close
public void close() throws javax.jms.JMSExceptionCloses all open queues left in enumerated objects. Because a provider can allocate some resources outside the JVM on behalf of queue browsers, 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:
closein interfaceAutoCloseable- Specified by:
closein interfacejavax.jms.QueueBrowser- Throws:
javax.jms.JMSException- if JMS fails to close this browser because of a JMS error.
-
getEnumeration
Gets an enumeration for browsing the current queue messages in the order that they are received.If the queue browser detects a poison message, it will not be returned to the enumeration. What happens to the poison message depends upon the IBM MQ messaging provider mode being used by the application:
Applications using IBM MQ messaging provider normal mode
--------------------------------------------------------------
If the MQQueueBrowser was created from an XASession that is taking part in a global transaction and the XASession has not previously been used to perform any transactional work, the message will be left on the queue. In all other cases, the IBM MQ classes for JMS will move the poison message to the backout requeue queue (as specified by the IBM MQ queue parameter BOQNAME) for the queue being browsed.Applications using IBM MQ messaging provider migration mode
-----------------------------------------------------------------
If the MQQueueBrowser was created from an XASession, the message will be left on the queue. In all other cases, the IBM MQ classes for JMS will move the poison message to the backout requeue queue (as specified by the IBM MQ queue parameter BOQNAME) for the queue being browsed.Note that if the browser is created for a nonexistent queue, this is not detected until the first call to this method.
- Specified by:
getEnumerationin interfacejavax.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.
-
getMessageSelector
Gets the queue browser's message selector expression.- Specified by:
getMessageSelectorin interfacejavax.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
-
getQueue
public javax.jms.Queue getQueue() throws javax.jms.JMSExceptionGets 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:
getQueuein interfacejavax.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.
-