title: ActiveMQ generating queues which don't exists
body: <p>I have a problem with using ActiveMQ in Spring application. </p>
  
  <p>I have a few environments on separate machines. On each machine I had one ActiveMQ instance installed. Now, I realized that I can have only one ActiveMQ instance installed on one server, and few applications can use that ActiveMQ for sending messages. So, I must change queue names in order to have different queues for different environments (<code>"queue.search.sandbox"</code>, <code>"queue.search.production"</code>, ...). </p>
  
  <p>After that change, now ActiveMQ is generating new queues, but also the old ones, although there is no such configuration for doing that. </p>
  
  <p>I am using Java Spring application with Java configuration, not XML. </p>
  
  <p>First, I create <code>queueTemplate</code> as a Spring bean: </p>
  
  <pre><code>@Bean
  public JmsTemplate jmsAuditQueueTemplate() {
      log.debug("ActiveMQConfiguration jmsAuditQueueTemplate");
      JmsTemplate jmsTemplate = new JmsTemplate();
      String queueName = "queue.audit.".concat(env.getProperty("activeMqBroker.queueName.suffix"));
      jmsTemplate.setDefaultDestination(new ActiveMQQueue(queueName));
      jmsTemplate.setConnectionFactory(connectionFactory());
      return jmsTemplate;
  }
  </code></pre>
  
  <p>Second, I create ActiveMQ <code>Listener</code> configuration:</p>
  
  <pre><code>@Bean
  public DefaultMessageListenerContainer jmsAuditQueueListenerContainer() {
      log.debug("ActiveMQConfiguration jmsAuditQueueListenerContainer");
      DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
      dmlc.setConnectionFactory(connectionFactory);
      String queueName = "queue.audit.".concat(env.getProperty("activeMqBroker.queueName.suffix"));
      ActiveMQQueue activeMQ = new ActiveMQQueue(queueName);
      dmlc.setDestination(activeMQ);
      dmlc.setRecoveryInterval(30000);
  
      dmlc.setSessionTransacted(true);
      // To perform actual message processing
      dmlc.setMessageListener(auditQueueListenerService);
  
      dmlc.setConcurrentConsumers(10);
      // ... more parameters that you might want to inject ...
      return dmlc;
  }
  </code></pre>
  
  <p>After building my application, as the result I have properly created queue with suffix (<code>"queue.audit.sandbox"</code>), but after some time ActiveMQ generates and the old version (<code>"queue.audit"</code>). </p>
  
  <p>Does someone knows how ActiveMQ is doing this? Thanks in advance.</p>