title: unable to consume message from queue with multiple rabbitMQ configuration
body: <p>I have 2 RabbitMQ connections and I want to use @RabbitListener on one of the queues in one of the RabbitMQ connection, but with my below code, the @RabbitListener is not able to capture message, even there is message in that particular queue. Can someone help me?</p>
  <p><strong>RabbitMQ 1 Connection configuration</strong></p>
  <pre><code>@Data
  @Configuration
  @ConfigurationProperties(prefix=&quot;p.spring.rabbitmq&quot;)
  public class RabbitMQPConfig{
      private String addresses;
      private String username;
      private String password;
      private int port;
      private String virtualHost;
      
      @Bean(name=&quot;pRabbitConnectionFactory&quot;)
      @Primary
      public ConnectionFactory rabbitConnectionFactory(){
          CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
          
          connectionFactory.setAddresses(addresses);
          connectionFactory.setPort(port);
          connectionFactory.setUsername(username);
          connectionFactory.setPassword(password)
          connectionFactory,setVirtualHost(virtualHost);
          
          return connectionFactory;
      }
      
      @Bean(name=&quot;pRabbitMessageConverter&quot;)
      public MessageConverter jsonMessageConverter(){
          return new Jackson2JsonMessageConverter();
      }
      
      @Bean(name=&quot;pRabbitTemplate&quot;)
      public RabbitTemplate rabbitTemplate(@Qualifier(&quot;pRabbitConnectionFactory&quot;) ConnectionFactory connectionFactory){
          final RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
          rabbitTemplate.setMessageConverter(jsonMessageConverter());
          return rabbitTemplate;
      }
      
  }
  </code></pre>
  <p><strong>RabbitMQ 2 Connection configuration</strong></p>
  <pre><code>@Data
  @Configuration
  @ConfigurationProperties(prefix = &quot;d.spring.rabbitmq&quot;)
  public class RabbitMQDConfig{
      private String addresses;
      private String username;
      private String password;
      private int port;
      private String virtualHost;
      
      @Bean(name = &quot;dRabbitConnectionFactory&quot;)
      public ConnectionFactory rabbitConnectionFactory(){
          CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
          
          connectionFactory.setAddresses(addresses);
          connectionFactory.setPort(port);
          connectionFactory.setUsername(username);
          connectionFactory.setPassword(password)
          connectionFactory,setVirtualHost(virtualHost);
          
          return connectionFactory;
      }
      
      @Bean(name=&quot;dRabbitMessageConverter&quot;)
      public MessageConverter jsonMessageConverter(){
          return new Jackson2JsonMessageConverter();
      }
      
      @Bean(name=&quot;dRabbitTemplate&quot;)
      public RabbitTemplate rabbitTemplate(@Qualifier(&quot;dRabbitConnectionFactory&quot;) ConnectionFactory connectionFactory){
          final RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
          rabbitTemplate.setMessageConverter(jsonMessageConverter());
          return rabbitTemplate;
      }
      
      @Bean(name=&quot;dRabbitListenerContainerFactory&quot;)
      public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(
          SimpleRabbitListenerContainerFactoryConfigurer configurer,
          @Qualifier(&quot;dRabbitConnectionFactory&quot;) ConnectionFactory connectionFactory
      ){
          SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
          configurer.configure(factory, connectionFactory);
          return factory;
      }
  }
  </code></pre>
  <p><strong>RabbitMQ Listener</strong></p>
  <pre><code>@Configuration
  public class RabbitMQListen{
  
      @RabbitListener(queues=&quot;&lt;put the queue name here&gt;&quot;, containerFactory=&quot;dRabbitListenerContainerFactory&quot;)
      public void receive(String task){ //Did not receive any message even there is messsage in the queue.. 
          System.out.println(&quot;&quot;);
      }
  
  }
  </code></pre>