Class ConsumerEventSource

  • All Implemented Interfaces:
    javax.jms.MessageListener, Service

    public class ConsumerEventSource
    extends 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 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 String getConsumerId()
      • 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)