Joram ${version}

org.objectweb.joram.client.jms
Class MessageConsumer

java.lang.Object
  extended byorg.objectweb.joram.client.jms.MessageConsumer
All Implemented Interfaces:
javax.jms.MessageConsumer
Direct Known Subclasses:
QueueReceiver, TopicSubscriber

public class MessageConsumer
extends java.lang.Object
implements javax.jms.MessageConsumer

Implements the javax.jms.MessageConsumer interface.


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()
          API method.
 java.lang.String getMessageSelector()
          API method.
 boolean getQueueMode()
           
 java.lang.String getTargetName()
           
 javax.jms.Message receive()
          API method.
 javax.jms.Message receive(long timeOut)
          API method implemented in subclasses.
 javax.jms.Message receiveNoWait()
          API method.
 void setMessageListener(javax.jms.MessageListener messageListener)
          API method.
 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

dest

protected Destination dest
The destination the consumer gets its messages from.


noLocal

protected boolean noLocal
true if the subscriber does not wish to consume messages produced by its connection.


sess

protected Session sess
The session the consumer belongs to.

Method Detail

getTargetName

public final java.lang.String getTargetName()

getQueueMode

public final boolean getQueueMode()

checkClosed

protected void checkClosed()
                    throws javax.jms.IllegalStateException
Throws:
javax.jms.IllegalStateException

toString

public java.lang.String toString()
Returns a string view of this consumer.


setMessageListener

public void setMessageListener(javax.jms.MessageListener messageListener)
                        throws javax.jms.JMSException
API method.

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!

Specified by:
setMessageListener in interface javax.jms.MessageConsumer
Throws:
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.

getMessageListener

public javax.jms.MessageListener getMessageListener()
                                             throws javax.jms.JMSException
API method.

Specified by:
getMessageListener in interface javax.jms.MessageConsumer
Throws:
javax.jms.IllegalStateException - If the consumer is closed.
javax.jms.JMSException

getMessageSelector

public final java.lang.String getMessageSelector()
                                          throws javax.jms.JMSException
API method.

Specified by:
getMessageSelector in interface javax.jms.MessageConsumer
Throws:
javax.jms.IllegalStateException - If the consumer is closed.
javax.jms.JMSException

receive

public javax.jms.Message receive(long timeOut)
                          throws javax.jms.JMSException
API method implemented in subclasses.

Specified by:
receive in interface javax.jms.MessageConsumer
Throws:
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.

receive

public javax.jms.Message receive()
                          throws javax.jms.JMSException
API method.

Specified by:
receive in interface javax.jms.MessageConsumer
Throws:
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.

receiveNoWait

public javax.jms.Message receiveNoWait()
                                throws javax.jms.JMSException
API method.

Specified by:
receiveNoWait in interface javax.jms.MessageConsumer
Throws:
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.

close

public void close()
           throws javax.jms.JMSException
API method.

Specified by:
close in interface javax.jms.MessageConsumer
Throws:
javax.jms.JMSException

Joram ${version}

Copyright © 2005 Scalagent - All rights reserved