org.apache.activemq.advisory
Class ConsumerEventSource
java.lang.Object
org.apache.activemq.advisory.ConsumerEventSource
- All Implemented Interfaces:
- MessageListener, Service
public class ConsumerEventSource
- extends Object
- implements Service, MessageListener
An object which can be used to listen to the number of active consumers
available on a given destination.
- Version:
- $Revision: 907647 $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConsumerEventSource
public ConsumerEventSource(Connection connection,
Destination destination)
throws JMSException
- Throws:
JMSException
setConsumerListener
public void setConsumerListener(ConsumerListener listener)
getConsumerId
public String getConsumerId()
start
public void start()
throws Exception
- Specified by:
start
in interface Service
- Throws:
Exception
stop
public void stop()
throws Exception
- Specified by:
stop
in interface Service
- Throws:
Exception
onMessage
public void onMessage(Message message)
- Specified by:
onMessage
in interface MessageListener
extractConsumerCountFromMessage
protected int extractConsumerCountFromMessage(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 Apache Software Foundation. All Rights Reserved.