org.apache.activemq.advisory
Class ConsumerEventSource
java.lang.Object
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.
- Version:
- $Revision: 426366 $
Constructor Summary |
ConsumerEventSource(javax.jms.Connection connection,
javax.jms.Destination destination)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConsumerEventSource
public ConsumerEventSource(javax.jms.Connection connection,
javax.jms.Destination destination)
throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
setConsumerListener
public void setConsumerListener(ConsumerListener listener)
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 © 2011 Apache Software Foundation. All Rights Reserved.