title: AmqpResourceNotAvailableException: The channelMax limit is reached. Try later
body: <p>I know that this error was mentioned in other posts as (<a href="https://github.com/spring-projects/spring-amqp/issues/999" rel="nofollow noreferrer">https://github.com/spring-projects/spring-amqp/issues/999</a> and <a href="https://github.com/spring-projects/spring-amqp/issues/853" rel="nofollow noreferrer">https://github.com/spring-projects/spring-amqp/issues/853</a> ) but I  haven't found the solution for me.</p>
  <p>My project has defined a set of microservices that publishing and consuminng messages by queue. when I
  run my stress tests with 200 Transaction per seconds I get this error:</p>
  <p>The channelMax limit is reached. Try later</p>
  <p>This error is only shown in one microservice in the rest no.</p>
  <p>I am using in my project:</p>
  <pre><code>spring-boot-starter-amqp.2.3.4.RELEASE
   spring-rabbit:2.2.11
  </code></pre>
  <p>and my setting of rabbit is :</p>
  <pre><code>  public ConnectionFactory publisherConnectionFactory() {
      final CachingConnectionFactory connectionFactory = new 
      CachingConnectionFactory(rabbitMQConfigProperties.getHost(), rabbitMQConfigProperties.getPort());
      connectionFactory.setUsername(rabbitMQConfigProperties.getUser());
      connectionFactory.setPassword(rabbitMQConfigProperties.getPass());
      connectionFactory.setPublisherReturns(true);
      connectionFactory.setPublisherConfirms(true);
      connectionFactory.setConnectionNameStrategy(connecFact -&gt; rabbitMQConfigProperties.getNameStrategy());
      connectionFactory.setRequestedHeartBeat(15);
      return connectionFactory;
  }
  
  
  @Bean(name = &quot;firstRabbitTemplate&quot;)
  public RabbitTemplate firstRabbitTemplate(MessageDeliveryCallbackService messageDeliveryCallbackService) {
      final RabbitTemplate template = new RabbitTemplate(publisherConnectionFactory());
      template.setMandatory(true);
      template.setMessageConverter(jsonMessageConverter());
      template.setReturnCallback((msg, i, s, s1, s2) -&gt; {
          log.error(&quot;Publisher Unable to deliver the message {} , Queue {}: --------------&quot;, s1, s2);
          messageDeliveryCallbackService.returnedMessage(msg, i, s, s1, s2);
      });
      template.setConfirmCallback((correlationData, ack, cause) -&gt; {
          if (!ack) {
              log.error(&quot;Message unable to connect Exchange, Cause {}: ack{}--------------&quot;, cause,ack);
          }
      });
      return template;
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/NbtGP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NbtGP.png" alt="enter image description here" /></a></p>
  <p>My questions are :</p>
  <p>Should I set up the ChannelCacheSize and setChannelCheckoutTimeout?. I did a test increasing the channelCacheSize to 50 but the issue is still happenning. What would it be the best value for these parameters as per I mentioned it earlier?. I read about channelCheckoutTimeout should be higher than 0 but I don't know what value i must set up.</p>
  <p>Right now i am processing around 200 Transaction per second but this number will be increased progressly</p>
  <p>Thank you in advance.</p>