Package org.apache.activemq.advisory
Class ConsumerEventSource
java.lang.Object
org.apache.activemq.advisory.ConsumerEventSource
- All Implemented Interfaces:
jakarta.jms.MessageListener
,Service
An object which can be used to listen to the number of active consumers
available on a given destination.
-
Constructor Summary
ConstructorDescriptionConsumerEventSource
(jakarta.jms.Connection connection, jakarta.jms.Destination destination) -
Method Summary
Modifier and TypeMethodDescriptionprotected int
extractConsumerCountFromMessage
(jakarta.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) void
onMessage
(jakarta.jms.Message message) void
setConsumerListener
(ConsumerListener listener) void
start()
void
stop()
-
Constructor Details
-
ConsumerEventSource
public ConsumerEventSource(jakarta.jms.Connection connection, jakarta.jms.Destination destination) throws jakarta.jms.JMSException - Throws:
jakarta.jms.JMSException
-
-
Method Details
-
setConsumerListener
-
getConsumerId
-
start
-
stop
-
onMessage
public void onMessage(jakarta.jms.Message message) - Specified by:
onMessage
in interfacejakarta.jms.MessageListener
-
extractConsumerCountFromMessage
protected int extractConsumerCountFromMessage(jakarta.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
-