title: RabbitMQ slow consumer causing queue pileup in spring boot rabbitmq integration
body: <p>I am consuming one queue with below configurations :</p>
  <pre><code>    @Bean
      public ConnectionFactory connectionFactory() {
              final CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
      
              connectionFactory.setUsername(&quot;abc&quot;);
              connectionFactory.setPassword(&quot;mnp&quot;);
              connectionFactory.setVirtualHost(&quot;xyz&quot;);
              connectionFactory.setHost(&quot;localhost&quot;);
              connectionFactory.setConnectionTimeout(60000);
              return connectionFactory;
          }
      
      @Bean(name = &quot;vmConnectionThreadPoolTaskExecutor&quot;)
          public Executor threadPoolTaskExecutor() {
                  ThreadPoolTaskExecutor vmConnectionStatusExecuter =  new ThreadPoolTaskExecutor();
                  vmConnectionStatusExecuter.setCorePoolSize(10);
                  vmConnectionStatusExecuter.setMaxPoolSize(30);
                  vmConnectionStatusExecuter.setQueueCapacity(10000);
                  vmConnectionStatusExecuter.setThreadGroupName(&quot;vmConnectionThreadPoolTaskExecutor&quot;);
                  vmConnectionStatusExecuter.setRejectedExecutionHandler(new RejectedExecutionHandler() {
                      @Override
                      public void rejectedExecution(Runnable r,
                                                    ThreadPoolExecutor executor) {
                          try {
                              long waitMs = 250;
                              Thread.sleep(waitMs);
                          } catch (InterruptedException interruptedException) {
                              LOGGER.info(&quot;Rejected vmConnectionThreadPoolTaskExecutor thread {} &quot;, r.getClass().getName());
                          }
          
                          executor.execute(r);
                      }
                  });
                  vmConnectionStatusExecuter.setKeepAliveSeconds(20);
                  vmConnectionStatusExecuter.setAllowCoreThreadTimeOut(true);
                  vmConnectionStatusExecuter.initialize();
                  return vmConnectionStatusExecuter;
              }
      
      
      
          @Bean
              public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
                  SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
                  factory.setConnectionFactory(connectionFactory);
                  factory.setAfterReceivePostProcessors( m -&gt; {
                      m.getMessageProperties().setContentType(MEDIA_TYPE_APPLICATION_JSON);
                      return m;
                  });
                  factory.setAcknowledgeMode(AcknowledgeMode.NONE);
                  factory.setConcurrentConsumers(10);
                  factory.setMaxConcurrentConsumers(30);
                  factory.setAutoStartup(true);
                  return factory;
              }
  
  @RabbitListener(queues = {&quot;${queue}&quot;}, containerFactory = RABBIT_LISTENER_CONTAINER_FACTORY)
      public void onMessage(Message message) {
              process(message);
  }
  
  
   @Async(&quot;vmConnectionThreadPoolTaskExecutor&quot;)
  public void  process(String message){
          //insert in mysql database
  }
  </code></pre>
  <p>Producer is sending 5K messages per second but consumer is slow and unable to handle high volume. I am running multiple consumers. This is causing pileup in the rabbitmq queue (large number of messages waiting in rabbitmq to get consumed and this keep increasing exponentially. Produced 2K messages/second through jmeter in rabbitmq and approx 120K messages were in the ready to consume/waiting state after 15 minutes of load test activity). How can we solve this issue to expect load more than 20K per second?</p>