Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-8298

mqtt auto-created topic is never auto-deleted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • None
    • False
    • None
    • False

      If an MQTT publisher (either v3 or v5) publishes to a topic with no subscribers, the AMQ address is never deleted.

      For example, after running this test, the address remains and is never deleted:

      package com.redhat.support.examples;
      
      import org.eclipse.paho.mqttv5.client.MqttClient;
      import org.eclipse.paho.mqttv5.client.MqttConnectionOptions;
      import org.eclipse.paho.mqttv5.client.persist.MemoryPersistence;
      import org.junit.Test;
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      
      public class DestinationCleanupTest {
      
          static final Logger logger = LoggerFactory.getLogger(DestinationCleanupTest.class);
      
          @Test
          public void testAmqpMqtt() throws Exception {
      
              String mqttUrl = "tcp://localhost:1883";
              String username = "admin";
              String password = "admin";
      
              MqttConnectionOptions options = new MqttConnectionOptions();;
              options.setCleanStart(true);
              options.setUserName(username);
              options.setPassword((password).getBytes());
              MqttClient testClient = new MqttClient(mqttUrl, "test-client-0", new MemoryPersistence());
              testClient.setTimeToWait(10000);
              testClient.connect(options);
              testClient.publish("foo/bar", "test".getBytes(), 1, false);
              testClient.disconnect();
          }
      }
      

      Broker.xml:

               <address-setting match="#">
      ...
                  <auto-delete-queues>true</auto-delete-queues>
      	    <auto-delete-queues-delay>0</auto-delete-queues-delay>
                  <auto-delete-addresses>true</auto-delete-addresses>
                  <auto-delete-addresses-delay>0</auto-delete-addresses-delay>
      ...
                </address-setting>
      

              Unassigned Unassigned
              rhn-support-shiggs Stephen Higgs
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: