org.apache.activemq.advisory
Class ConsumerEventSource

java.lang.Object
  extended by org.apache.activemq.advisory.ConsumerEventSource
All Implemented Interfaces:
javax.jms.MessageListener, Service

public class ConsumerEventSource
extends java.lang.Object
implements Service, javax.jms.MessageListener

An object which can be used to listen to the number of active consumers available on a given destination.


Constructor Summary
ConsumerEventSource(javax.jms.Connection connection, javax.jms.Destination destination)
           
 
Method Summary
protected  int extractConsumerCountFromMessage(javax.jms.Message message, int count)
          Lets rely by default on the broker telling us what the consumer count is as it can ensure that we are up to date at all times and have not received messages out of order etc.
protected  void fireConsumerEvent(ConsumerEvent event)
           
 java.lang.String getConsumerId()
           
 void onMessage(javax.jms.Message message)
           
 void setConsumerListener(ConsumerListener listener)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsumerEventSource

public ConsumerEventSource(javax.jms.Connection connection,
                           javax.jms.Destination destination)
                    throws javax.jms.JMSException
Throws:
javax.jms.JMSException
Method Detail

setConsumerListener

public void setConsumerListener(ConsumerListener listener)

getConsumerId

public java.lang.String getConsumerId()

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Service
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Specified by:
stop in interface Service
Throws:
java.lang.Exception

onMessage

public void onMessage(javax.jms.Message message)
Specified by:
onMessage in interface javax.jms.MessageListener

extractConsumerCountFromMessage

protected int extractConsumerCountFromMessage(javax.jms.Message message,
                                              int count)
Lets rely by default on the broker telling us what the consumer count is as it can ensure that we are up to date at all times and have not received messages out of order etc.


fireConsumerEvent

protected void fireConsumerEvent(ConsumerEvent event)


Copyright © 2005-2011 FuseSource, Corp.. All Rights Reserved.