com.caucho.jms.connection
Class MessageConsumerImpl<E>

java.lang.Object
  extended by com.caucho.jms.connection.MessageConsumerImpl<E>
All Implemented Interfaces:
MessageConsumer
Direct Known Subclasses:
QueueReceiverImpl, TopicSubscriberImpl

public class MessageConsumerImpl<E>
extends java.lang.Object
implements MessageConsumer

A basic message consumer.


Field Summary
protected  Selector _selector
           
protected  JmsSession _session
           
 
Method Summary
 void addMessageCallback()
           
 void close()
          Closes the consumer.
protected  AbstractDestination<E> getDestination()
          Returns the destination
 MessageListener getMessageListener()
          Returns the message listener
 java.lang.String getMessageSelector()
          Returns the message consumer's selector.
 boolean getNoLocal()
          Returns true if local messages are not sent.
 Selector getSelector()
          Returns the parsed selector.
 boolean isActive()
          Returns true if active
 boolean isClosed()
          Returns true if closed
 boolean notifyMessageAvailable()
          Notifies that a message is available.
 Message receive()
          Receives the next message, blocking until a message is available.
 Message receive(long timeout)
          Receives a message from the queue.
protected  Message receiveImpl(long timeout)
          Receives a message from the queue.
 Message receiveNoWait()
          Receives a message from the queue.
 void setMessageListener(MessageListener listener)
          Sets the message listener
 void setMessageListener(MessageListener listener, long pollInterval)
          Sets the message listener with a poll interval
 void start()
          Starts the consumer
 void stop()
          Stops the consumer.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_session

protected final JmsSession _session

_selector

protected Selector _selector
Method Detail

getDestination

protected AbstractDestination<E> getDestination()
                                         throws JMSException
Returns the destination

Throws:
JMSException

getNoLocal

public boolean getNoLocal()
                   throws JMSException
Returns true if local messages are not sent.

Throws:
JMSException

getMessageListener

public MessageListener getMessageListener()
                                   throws JMSException
Returns the message listener

Specified by:
getMessageListener in interface MessageConsumer
Throws:
JMSException

setMessageListener

public void setMessageListener(MessageListener listener)
                        throws JMSException
Sets the message listener

Specified by:
setMessageListener in interface MessageConsumer
Throws:
JMSException

setMessageListener

public void setMessageListener(MessageListener listener,
                               long pollInterval)
                        throws JMSException
Sets the message listener with a poll interval

Throws:
JMSException

getMessageSelector

public java.lang.String getMessageSelector()
                                    throws JMSException
Returns the message consumer's selector.

Specified by:
getMessageSelector in interface MessageConsumer
Throws:
JMSException

getSelector

public Selector getSelector()
Returns the parsed selector.


isActive

public boolean isActive()
                 throws JMSException
Returns true if active

Throws:
JMSException

isClosed

public boolean isClosed()
Returns true if closed


receive

public Message receive()
                throws JMSException
Receives the next message, blocking until a message is available.

Specified by:
receive in interface MessageConsumer
Throws:
JMSException

receiveNoWait

public Message receiveNoWait()
                      throws JMSException
Receives a message from the queue.

Specified by:
receiveNoWait in interface MessageConsumer
Throws:
JMSException

receive

public Message receive(long timeout)
                throws JMSException
Receives a message from the queue.

Specified by:
receive in interface MessageConsumer
Throws:
JMSException

receiveImpl

protected Message receiveImpl(long timeout)
                       throws JMSException
Receives a message from the queue.

Throws:
JMSException

notifyMessageAvailable

public boolean notifyMessageAvailable()
Notifies that a message is available.


addMessageCallback

public void addMessageCallback()

start

public void start()
Starts the consumer


stop

public void stop()
          throws JMSException
Stops the consumer.

Throws:
JMSException

close

public void close()
           throws JMSException
Closes the consumer.

Specified by:
close in interface MessageConsumer
Throws:
JMSException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object