Package 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.
-
-
Constructor Summary
Constructors Constructor Description ConsumerEventSource(Connection connection, Destination destination)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected void
fireConsumerEvent(ConsumerEvent event)
String
getConsumerId()
void
onMessage(Message message)
void
setConsumerListener(ConsumerListener listener)
void
start()
void
stop()
-
-
-
Constructor Detail
-
ConsumerEventSource
public ConsumerEventSource(Connection connection, Destination destination) throws JMSException
- Throws:
JMSException
-
-
Method Detail
-
setConsumerListener
public void setConsumerListener(ConsumerListener listener)
-
getConsumerId
public String getConsumerId()
-
start
public void start() throws Exception
-
onMessage
public void onMessage(Message message)
- Specified by:
onMessage
in interfaceMessageListener
-
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)
-
-