|
Joram 5.3.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.joram.client.jms.MessageConsumer
public class MessageConsumer
Implements the javax.jms.MessageConsumer
interface.
A client uses a MessageConsumer object to receive messages from a
destination. A MessageConsumer object is created by calling the
createConsumer method on a session object. A message consumer is
normally dedicated to a unique destination.
A message consumer can be created with a message selector. A message
selector allows the client to restrict the messages delivered to the
message consumer to those that match the selector.
A client may either synchronously receive a message consumer's messages or
have the consumer asynchronously deliver them as they arrive:
Field Summary | |
---|---|
protected Destination |
dest
The destination the consumer gets its messages from. |
protected boolean |
noLocal
true if the subscriber does not wish to consume messages
produced by its connection. |
protected Session |
sess
The session the consumer belongs to. |
Method Summary | |
---|---|
protected void |
checkClosed()
|
void |
close()
API method. |
javax.jms.MessageListener |
getMessageListener()
Gets the message consumer's MessageListener. |
java.lang.String |
getMessageSelector()
Gets this message consumer's message selector expression. |
boolean |
getQueueMode()
|
java.lang.String |
getTargetName()
|
javax.jms.Message |
receive()
Receives the next message produced for this message consumer. |
javax.jms.Message |
receive(long timeOut)
Receives the next message that arrives before the specified timeout. |
javax.jms.Message |
receiveNoWait()
Receives the next message if one is immediately available. |
void |
setMessageListener(javax.jms.MessageListener messageListener)
Sets the message consumer's MessageListener. |
java.lang.String |
toString()
Returns a string view of this consumer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Destination dest
protected boolean noLocal
true
if the subscriber does not wish to consume messages
produced by its connection.
protected Session sess
Method Detail |
---|
public final java.lang.String getTargetName()
public final boolean getQueueMode()
protected void checkClosed() throws javax.jms.IllegalStateException
javax.jms.IllegalStateException
public java.lang.String toString()
toString
in class java.lang.Object
public void setMessageListener(javax.jms.MessageListener messageListener) throws javax.jms.JMSException
This method must not be called if the connection the consumer belongs to is started, because the session would then be accessed by the thread calling this method and by the thread controlling asynchronous deliveries. This situation is clearly forbidden by the single threaded nature of sessions. Moreover, unsetting a message listener without stopping the connection may lead to the situation where asynchronous deliveries would arrive on the connection, the session or the consumer without being able to reach their target listener!
setMessageListener
in interface javax.jms.MessageConsumer
javax.jms.IllegalStateException
- If the consumer is closed, or if the
connection is broken.
javax.jms.JMSException
- If the request fails for any other reason.public javax.jms.MessageListener getMessageListener() throws javax.jms.JMSException
getMessageListener
in interface javax.jms.MessageConsumer
javax.jms.IllegalStateException
- If the consumer is closed.
javax.jms.JMSException
public final java.lang.String getMessageSelector() throws javax.jms.JMSException
getMessageSelector
in interface javax.jms.MessageConsumer
javax.jms.IllegalStateException
- If the consumer is closed.
javax.jms.JMSException
public javax.jms.Message receive(long timeOut) throws javax.jms.JMSException
receive
in interface javax.jms.MessageConsumer
javax.jms.IllegalStateException
- If the consumer is closed, or if the
connection is broken.
javax.jms.JMSSecurityException
- If the requester is not a READER on the
destination.
javax.jms.JMSException
- If the request fails for any other reason.public javax.jms.Message receive() throws javax.jms.JMSException
receive
in interface javax.jms.MessageConsumer
javax.jms.IllegalStateException
- If the consumer is closed, or if the
connection is broken.
javax.jms.JMSSecurityException
- If the requester is not a READER on the
destination.
javax.jms.JMSException
- If the request fails for any other reason.public javax.jms.Message receiveNoWait() throws javax.jms.JMSException
receiveNoWait
in interface javax.jms.MessageConsumer
javax.jms.IllegalStateException
- If the consumer is closed, or if the
connection is broken.
javax.jms.JMSSecurityException
- If the requester is not a READER on the
destination.
javax.jms.JMSException
- If the request fails for any other reason.public void close() throws javax.jms.JMSException
close
in interface javax.jms.MessageConsumer
javax.jms.JMSException
|
Joram 5.3.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |