title: How to listen to a dynamically created queue?
body: <p>I have a rabbitListener which continuously listens to user messages of a queue "user-messages" asynchronously. Everything is OK until unless queue is loaded with bulk messages. When messages in bulk published to queue, messages of the <strong>same user</strong> are processing first thereby messages of other users are waiting for their turn. </p>
  
  <p>I can't use <strong>Priority Queue</strong> because all the users have equal priority. So I want to create new queues and listen to them at <strong>runtime</strong>. All the queues will be short-lived as soon as messages consumed. (the queue will be deleted)</p>
  
  <p>On browsing, I found a queue can be dynamically created using <strong>RabbitAdmin</strong>. But the issues are</p>
  
  <ol>
  <li>How can I make my listener listen to a new short-live (TTL) queue created at runtime?</li>
  <li>How can I make the listener stop listening to a deleted queue (after TTL time) to avoid exceptions?</li>
  </ol>
  
  <p>Currently, I'm using SimpleMessageListenerContainerFactory. I've no issues to use DirectMessageListenerContainer as well. My only concern is <strong>how to communicate about dynamic queue creation &amp; deletion to Listener</strong>. Thinking about to <a href="https://www.rabbitmq.com/event-exchange.html" rel="nofollow noreferrer">https://www.rabbitmq.com/event-exchange.html</a> (event exchange plugin). </p>
  
  <p>Is there any way that spring-amqp supporting <strong>start/stop</strong> listening dynamic queues. Thanks in advance.</p>
  
  <pre><code>    @Bean
      public SimpleRabbitListenerContainerFactory myRabbitListenerContainerFactory() {
          SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
          factory.setConnectionFactory(config.getConnectionFactory());
          factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
          factory.setConcurrentConsumers(1);
          factory.setMaxConcurrentConsumers(3);
          return factory;
      }
  
      @RabbitListener(id = "listener", queues = {
              "#{receiver.queues()}" }, containerFactory = "myRabbitListenerContainerFactory")
      public void listen(QueueMessage message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag,
              MessageHeaders headers) {
           //process message
      }
  
  
    [1]: https://www.rabbitmq.com/event-exchange.html
  </code></pre>