Spring-amqp two queues with different TTL

In our application, we use RabbitMQ and spring-amqp(1.4.3.RELEASE). We have two Queues there. Both of them have TTL(60000 and 100000) configured. When we start the application, it gives the following errors:

[pool-4-thread-1] ERROR org.springframework.amqp.rabbit.connection.CachingConnectionFactory - Channel shutdown: channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-message-ttl' for queue 'queue1' in vhost '/': received '60000' but current is '100000', class-id=50, method-id=10)

And then an exception is thrown when we try to send message to the queue:

[http-nio-8080-exec-8] ERROR [P181786EJG755SN8I3S74584216UV1] No reply received - perhaps a timeout in the template? org.springframework.remoting.RemoteProxyFailureException: No reply received - perhaps a timeout in the template? at org.springframework.amqp.remoting.client.AmqpClientInterceptor.invoke(AmqpClientInterceptor.java:60) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy83.getUserById(Unknown Source)

Search on the internet gave the following result:

http://forum.spring.io/forum/spring-projects/integration/amqp/124865-unexpected-behaviour-with-rabbit-admin And especially, this bug: https://jira.spring.io/browse/AMQP-266

After we have found that bug, we have changed TTL values for both queues to 60000, and Error is not shown anymore. And application is running fine. So, it seems that there is still a bug with TTL.


Solution 1:

I have found the problem, it was related to wrong configuration. So, to troubleshoot this problem:

  1. Check, that Queue declared in the Rabbit-Server has same parameters in spring-configurations. Good thing this is to remove completely queues from rabbit and start application.
  2. In the applications there could be several places where queues can be declared. Check that all of them have same parameters. If they have different parameters, it can lead to problem (That was my case).

Solution 2:

Dmitrii Semenov Response is correct, Just for a suggestion:

"Try removing queue from rabbitmq-management"

NOTE: From docker you can access to "your ip or localhost":15672

enter image description here

enter image description here

Ref: https://github.com/streadway/amqp/issues/60#issuecomment-18119437