Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-4906

advisory producerCount = 0 is not received on temporary queue

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.7.0
    • 5.10.0
    • Broker
    • None

    Description

      i notice i never receive producer advisory messages (ActiveMQ.Advisory.Producer.Queue .[...]) with producerCount=0 when the client message producers on temporary queue are closed. i do receive producerCount > 0.

      However, the consumerCount (from ActiveMQ.Advisory.Consumer.Queue.[...]) appears to work as expected.

      From looking into org.apache.activemq.advisory.AdvisoryBroker.java

      @Override
          public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception {
              super.removeProducer(context, info);
      
              // Don't advise advisory topics.
              ActiveMQDestination dest = info.getDestination();
              if (info.getDestination() != null && !AdvisorySupport.isAdvisoryTopic(dest)) {
                  ActiveMQTopic topic = AdvisorySupport.getProducerAdvisoryTopic(dest);
                  producers.remove(info.getProducerId());
                  if (!dest.isTemporary() || destinations.contains(dest)) { // PLEASE NOTE: <== could this actually be destinations.containsKey(dest)
                      fireProducerAdvisory(context, dest,topic, info.createRemoveCommand());
                  }
              }
          }
      

      as reference, the "working" removeConsumer method:

      @Override
          public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
              super.removeConsumer(context, info);
      
              // Don't advise advisory topics.
              ActiveMQDestination dest = info.getDestination();
              if (!AdvisorySupport.isAdvisoryTopic(dest)) {
                  ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(dest);
                  consumers.remove(info);
                  if (!dest.isTemporary() || destinations.containsKey(dest)) {
                      fireConsumerAdvisory(context,dest, topic, info.createRemoveCommand());
                  }
              }
          }
      

      Please note the destinations.containsKey(dest) vs destinations.contains(dest) (for concurrentHashMaps this is identical to containsValue()). I'm assuming the logic is to make sure the producer destination do exist in both cases

      I tested this with 5.7.0. the code is similar in 5.9.0

      Attachments

        Issue Links

          Activity

            People

              rajdavies Robert Davies
              cmamen Christian Mamen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: