jrun.jms.core.client
Class JmsMessageConsumer

jrun.jms.core.client.JmsMessageConsumer

public abstract class JmsMessageConsumer

This is an abstract class that defines the generic behaviour of a consumer. A consumer is created and controlled through a session

Instances of these class pertain to a Destination, whether it is a queue or a topic. In addition a consumer can only be created through a valid session.

Version:
$Revision: 1.22 $ $Date: 2001/10/12 07:55:31 $
Author:
Jim Alateras
See Also:
org.exolab.jms.client.JmsQueueReceiver

Field Summary
protected  JmsSession _session
          A consumer needs to be allocated through the session.
 
Method Summary
 void close()
           
 void destroy()
          Release all resources used by this consumer
 long getClientId()
          Return the session allocated consumer identifier
 java.lang.String getConsumerId()
          This accessor will return a reference to the consumer id.
abstract  JmsDestination getJmsDestination()
          This is an anstratc message that returns a reference to the destination
 long getLastMessageDelivered()
          Return the last message asynchronously delivered to the consumer
protected  Logger getLogger()
          Return a reference to the logger.
 javax.jms.MessageListener getMessageListener()
           
 java.lang.String getMessageSelector()
           
 boolean isClosed()
          Returns state of consumer
 void onMessage(javax.jms.Message message)
          Whenever a message is received for this destination it is processed as follows.
 javax.jms.Message receive()
           
 javax.jms.Message receive(long timeout)
           
 javax.jms.Message receiveNoWait()
           
 javax.jms.Message retrieveMessage()
          This method will make a synchronous call to the server and retrieve the first message in the cache.
 void setMessageListener(javax.jms.MessageListener listener)
           
 

Field Detail

_session

protected JmsSession _session
A consumer needs to be allocated through the session. This instance is aa back pointer to the session
Method Detail

isClosed

public boolean isClosed()
Returns state of consumer

getConsumerId

public java.lang.String getConsumerId()
This accessor will return a reference to the consumer id. It could be null.
Returns:
String

getClientId

public long getClientId()
Return the session allocated consumer identifier
Returns:
the identifier allocated to this by the session

getMessageSelector

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

getMessageListener

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

setMessageListener

public void setMessageListener(javax.jms.MessageListener listener)
                        throws javax.jms.JMSException

receive

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

receiveNoWait

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

receive

public javax.jms.Message receive(long timeout)
                          throws javax.jms.JMSException

close

public void close()
           throws javax.jms.JMSException

destroy

public void destroy()
             throws javax.jms.JMSException
Release all resources used by this consumer
Throws:
JMSException -  

onMessage

public void onMessage(javax.jms.Message message)
Whenever a message is received for this destination it is processed as follows. If a message listener has been designated then it is sent straight to the message listener. If a message listener has not been registered for this destination it is placed on the cache.
Parameters:
message - message received

retrieveMessage

public javax.jms.Message retrieveMessage()
                                  throws javax.jms.JMSException
This method will make a synchronous call to the server and retrieve the first message in the cache. It will return null if there are no messages yet.

If there are any problems then return JMSException

Returns:
Message
Throws:
JMSException -  

getLastMessageDelivered

public long getLastMessageDelivered()
Return the last message asynchronously delivered to the consumer
Returns:
String - last message delivered

getLogger

protected Logger getLogger()
Return a reference to the logger.
Returns:
Logger

getJmsDestination

public abstract JmsDestination getJmsDestination()
This is an anstratc message that returns a reference to the destination
Returns:
JmsDestination


Copyright � 2002 Macromedia Corporation. All Rights Reserved.