org.objectweb.joram.client.jms
Class MessageConsumerListener

java.lang.Object
  extended by org.objectweb.joram.client.jms.MessageConsumerListener
All Implemented Interfaces:
ReplyListener
Direct Known Subclasses:
MultiSessionConsumer, SingleSessionConsumer

abstract class MessageConsumerListener
extends java.lang.Object
implements ReplyListener

This class listens to replies asynchronously returned by the user proxy for a message consumer.


Nested Class Summary
private static class MessageConsumerListener.ReceiveStatus
           
protected static class MessageConsumerListener.Status
          Status of the message consumer listener.
 
Field Summary
private  boolean durable
           
private  javax.jms.MessageListener listener
           
static org.objectweb.util.monolog.api.Logger logger
           
private  int messageCount
          The number of messages which are in queue (Session.qin) waiting for being consumed.
private  java.util.Vector messagesToAck
           
private  int queueMessageReadMax
           
private  boolean queueMode
           
private  int receiveStatus
          The receive status of this message listener: - WAIT_FOR_REPLY if a reply is expected from the destination - CONSUMING_REPLY if a reply is being consumed and no new request has been sent
private  int requestId
          The identifier of the subscription request.
private  RequestMultiplexer rm
           
private  java.lang.String selector
           
private  int status
           
private  java.lang.String targetName
           
private  int topicAckBufferMax
           
private  int topicActivationThreshold
           
private  boolean topicMsgInputPassivated
          Indicates whether the topic message input has been passivated or not.
private  int topicPassivationThreshold
           
 
Constructor Summary
MessageConsumerListener(boolean queueMode, boolean durable, java.lang.String selector, java.lang.String targetName, javax.jms.MessageListener listener, int queueMessageReadMax, int topicActivationThreshold, int topicPassivationThreshold, int topicAckBufferMax, RequestMultiplexer reqMultiplexer)
           
 
Method Summary
(package private)  void ack(java.lang.String msgId, int ackMode)
           
private  void acknowledge(int threshold)
           
protected  void activateListener(Message msg, javax.jms.MessageListener listener, int ackMode)
           
(package private)  void activateMessageInput()
           
 void close()
          Called by Session.
private  int decreaseMessageCount(int ackMode)
          Decrease the message count.
 javax.jms.MessageListener getMessageListener()
           
 boolean getQueueMode()
           
protected  int getStatus()
           
 java.lang.String getTargetName()
           
 boolean isClosed()
           
 void onMessage(Message msg, int ackMode)
          Called by Session (standard JMS, mono-threaded
abstract  void onMessage(Message msg, javax.jms.MessageListener listener, int ackMode)
           
(package private)  void passivateMessageInput()
           
abstract  void pushMessages(ConsumerMessages cm)
          Pushes the received messages.
 void replyAborted(int requestId)
           
 boolean replyReceived(AbstractJmsReply reply)
          Called by RequestMultiplexer.
private  void setReceiveStatus(int s)
           
protected  void setStatus(int status)
           
(package private)  void start()
          Called by Session.
private  void subscribe(java.lang.String[] toAck)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static org.objectweb.util.monolog.api.Logger logger

queueMode

private boolean queueMode

durable

private boolean durable

selector

private java.lang.String selector

targetName

private java.lang.String targetName

requestId

private volatile int requestId
The identifier of the subscription request.


status

private int status

messagesToAck

private java.util.Vector messagesToAck

messageCount

private volatile int messageCount
The number of messages which are in queue (Session.qin) waiting for being consumed.


receiveStatus

private volatile int receiveStatus
The receive status of this message listener: - WAIT_FOR_REPLY if a reply is expected from the destination - CONSUMING_REPLY if a reply is being consumed and no new request has been sent


topicMsgInputPassivated

private boolean topicMsgInputPassivated
Indicates whether the topic message input has been passivated or not.


queueMessageReadMax

private int queueMessageReadMax

rm

private RequestMultiplexer rm

topicActivationThreshold

private int topicActivationThreshold

topicPassivationThreshold

private int topicPassivationThreshold

topicAckBufferMax

private int topicAckBufferMax

listener

private javax.jms.MessageListener listener
Constructor Detail

MessageConsumerListener

MessageConsumerListener(boolean queueMode,
                        boolean durable,
                        java.lang.String selector,
                        java.lang.String targetName,
                        javax.jms.MessageListener listener,
                        int queueMessageReadMax,
                        int topicActivationThreshold,
                        int topicPassivationThreshold,
                        int topicAckBufferMax,
                        RequestMultiplexer reqMultiplexer)
Method Detail

getStatus

protected final int getStatus()

setStatus

protected void setStatus(int status)

setReceiveStatus

private void setReceiveStatus(int s)

decreaseMessageCount

private int decreaseMessageCount(int ackMode)
                          throws javax.jms.JMSException
Decrease the message count. Synchronized with the method replyReceived() that increments the messageCount += cm.getMessageCount();

Returns:
the decreased value
Throws:
javax.jms.JMSException

start

void start()
     throws javax.jms.JMSException
Called by Session.

Throws:
javax.jms.JMSException

subscribe

private void subscribe(java.lang.String[] toAck)
                throws javax.jms.JMSException
Throws:
javax.jms.JMSException

close

public void close()
           throws javax.jms.JMSException
Called by Session.

Throws:
javax.jms.JMSException

acknowledge

private void acknowledge(int threshold)

replyReceived

public boolean replyReceived(AbstractJmsReply reply)
                      throws AbortedRequestException
Called by RequestMultiplexer.

Specified by:
replyReceived in interface ReplyListener
Returns:
whether the request must be aborted or not.
Throws:
AbortedRequestException

pushMessages

public abstract void pushMessages(ConsumerMessages cm)
                           throws javax.jms.JMSException
Pushes the received messages. Currently two behaviors: 1- SingleSessionConsumer pushes the message in a single session (standard JMS) 2- MultiSessionConsumer pushes the message in several session (from a session pool)

Parameters:
cm -
Throws:
javax.jms.JMSException

replyAborted

public void replyAborted(int requestId)
Specified by:
replyAborted in interface ReplyListener

isClosed

public boolean isClosed()

getMessageListener

public final javax.jms.MessageListener getMessageListener()

getQueueMode

public final boolean getQueueMode()

getTargetName

public final java.lang.String getTargetName()

activateListener

protected void activateListener(Message msg,
                                javax.jms.MessageListener listener,
                                int ackMode)
                         throws javax.jms.JMSException
Throws:
javax.jms.JMSException

onMessage

public abstract void onMessage(Message msg,
                               javax.jms.MessageListener listener,
                               int ackMode)
                        throws javax.jms.JMSException
Throws:
javax.jms.JMSException

onMessage

public void onMessage(Message msg,
                      int ackMode)
               throws javax.jms.JMSException
Called by Session (standard JMS, mono-threaded

Throws:
javax.jms.JMSException

ack

void ack(java.lang.String msgId,
         int ackMode)
   throws javax.jms.JMSException
Throws:
javax.jms.JMSException

activateMessageInput

void activateMessageInput()
                    throws javax.jms.JMSException
Throws:
javax.jms.JMSException

passivateMessageInput

void passivateMessageInput()
                     throws javax.jms.JMSException
Throws:
javax.jms.JMSException


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.