Package org.objectweb.joram.client.jms
Class QueueBrowser
- java.lang.Object
-
- org.objectweb.joram.client.jms.QueueBrowser
-
- All Implemented Interfaces:
AutoCloseable,QueueBrowser
public class QueueBrowser extends Object implements QueueBrowser
Implements thejavax.jms.QueueBrowserinterface.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classQueueBrowser.QueueEnumerationTheQueueEnumerationclass is used to enumerate the browses sent by queues.
-
Field Summary
Fields Modifier and Type Field Description private booleanclosedtrueif the browser is closed.private static org.objectweb.util.monolog.api.Loggerloggerprivate QueuequeueThe queue the browser browses.private StringselectorThe selector for filtering messages.private SessionsessThe session the browser belongs to.
-
Constructor Summary
Constructors Constructor Description QueueBrowser(Session sess, Queue queue, String selector)Constructs a browser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()API method.EnumerationgetEnumeration()API method.StringgetMessageSelector()API method.QueuegetQueue()API method.StringtoString()Returns a string view of this browser.
-
-
-
Field Detail
-
sess
private Session sess
The session the browser belongs to.
-
queue
private Queue queue
The queue the browser browses.
-
selector
private String selector
The selector for filtering messages.
-
closed
private boolean closed
trueif the browser is closed.
-
logger
private static org.objectweb.util.monolog.api.Logger logger
-
-
Constructor Detail
-
QueueBrowser
QueueBrowser(Session sess, Queue queue, String selector) throws JMSException
Constructs a browser.- Parameters:
sess- The session the browser belongs to.queue- The queue the browser browses.selector- The selector for filtering messages.- Throws:
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.
-
-
Method Detail
-
toString
public String toString()
Returns a string view of this browser.
-
getQueue
public Queue getQueue() throws JMSException
API method.- Specified by:
getQueuein interfaceQueueBrowser- Throws:
IllegalStateException- If the browser is closed.JMSException
-
getMessageSelector
public String getMessageSelector() throws JMSException
API method. Gets this queue browser's message selector expression.- Specified by:
getMessageSelectorin interfaceQueueBrowser- Returns:
- this queue browser's message selector, or null if no message selector exists for the message consumer.
- Throws:
IllegalStateException- If the browser is closed.JMSException
-
getEnumeration
public Enumeration getEnumeration() throws JMSException
API method. Gets an enumeration for browsing the current queue messages in the order they would be received.- Specified by:
getEnumerationin interfaceQueueBrowser- Returns:
- an enumeration for browsing the messages.
- Throws:
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.
-
close
public void close() throws JMSExceptionAPI method. Closes the QueueBrowser.In order to free significant resources allocated on behalf of a QueueBrowser, clients should close them when they are not needed.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceQueueBrowser- Throws:
JMSException- Actually never thrown.
-
-