public class QueueBrowser extends Object implements QueueBrowser
javax.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.
|
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 JMSException
sess
- The session the browser belongs to.queue
- The queue the browser browses.selector
- The selector for filtering messages.InvalidDestinationException
- if an invalid destination is specified.InvalidSelectorException
- If the selector syntax is invalid.IllegalStateException
- If the connection is broken.JMSException
- If the creation fails for any other reason.public String toString()
public Queue getQueue() throws JMSException
getQueue
in interface QueueBrowser
IllegalStateException
- If the browser is closed.JMSException
public String getMessageSelector() throws JMSException
getMessageSelector
in interface QueueBrowser
IllegalStateException
- If the browser is closed.JMSException
public Enumeration getEnumeration() throws JMSException
getEnumeration
in interface QueueBrowser
IllegalStateException
- If the browser is closed, or if the
connection is broken.JMSSecurityException
- If the client is not a READER on the
queue.JMSException
- If the request fails for any other reason.public void close() throws 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 QueueBrowser
JMSException
- Actually never thrown.Copyright © 2020 ScalAgent D.T.. All rights reserved.