public class QueueBrowser extends Object implements jakarta.jms.QueueBrowser
jakarta.jms.QueueBrowser interface.
A client uses a QueueBrowser object to look at messages on a queue without removing them.
The getEnumeration method returns 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 contain only the messages matching a message selector.
A QueueBrowser can be created from either a Session or a QueueSession.
| Modifier and Type | Class and Description |
|---|---|
private class |
QueueBrowser.QueueEnumeration
The
QueueEnumeration class is used to enumerate the browses
sent by queues. |
| Modifier and Type | Field and Description |
|---|---|
private boolean |
closed
true if the browser is closed. |
private static org.objectweb.util.monolog.api.Logger |
logger |
private Queue |
queue
The queue the browser browses.
|
private String |
selector
The selector for filtering messages.
|
private Session |
sess
The session the browser belongs to.
|
| Constructor and Description |
|---|
QueueBrowser(Session sess,
Queue queue,
String selector)
Constructs a browser.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
API method.
|
Enumeration |
getEnumeration()
API method.
|
String |
getMessageSelector()
API method.
|
jakarta.jms.Queue |
getQueue()
API method.
|
String |
toString()
Returns a string view of this browser.
|
private Session sess
private Queue queue
private String selector
private boolean closed
true if the browser is closed.private static org.objectweb.util.monolog.api.Logger logger
QueueBrowser(Session sess, Queue queue, String selector) throws jakarta.jms.JMSException
sess - The session the browser belongs to.queue - The queue the browser browses.selector - The selector for filtering messages.jakarta.jms.InvalidDestinationException - if an invalid destination is specified.jakarta.jms.InvalidSelectorException - If the selector syntax is invalid.jakarta.jms.IllegalStateException - If the connection is broken.jakarta.jms.JMSException - If the creation fails for any other reason.public String toString()
public jakarta.jms.Queue getQueue()
throws jakarta.jms.JMSException
getQueue in interface jakarta.jms.QueueBrowserjakarta.jms.IllegalStateException - If the browser is closed.jakarta.jms.JMSExceptionpublic String getMessageSelector() throws jakarta.jms.JMSException
getMessageSelector in interface jakarta.jms.QueueBrowserjakarta.jms.IllegalStateException - If the browser is closed.jakarta.jms.JMSExceptionpublic Enumeration getEnumeration() throws jakarta.jms.JMSException
getEnumeration in interface jakarta.jms.QueueBrowserjakarta.jms.IllegalStateException - If the browser is closed, or if the
connection is broken.jakarta.jms.JMSSecurityException - If the client is not a READER on the
queue.jakarta.jms.JMSException - If the request fails for any other reason.public void close()
throws jakarta.jms.JMSException
In order to free significant resources allocated on behalf of a QueueBrowser, clients should close them when they are not needed.
close in interface jakarta.jms.QueueBrowserclose in interface AutoCloseablejakarta.jms.JMSException - Actually never thrown.Copyright © 2023 ScalAgent D.T.. All rights reserved.