[rabbitmq-discuss] Double ack problem with spring-rabbit ?

Michael Patel mpatel.grad at googlemail.com
Fri Jun 1 14:00:39 BST 2012


Hello all,

I'm getting the a double ack (I believe) error when the rabbitmq consumer 
dies and error recovery begins to happen : 

12:37:10.625 [SimpleAsyncTaskExecutor-1] WARN 
o.s.a.r.l.SimpleMessageListenerContainer - Consumer failed irretrievably on 
restart. class org.springframework.amqp.AmqpIOException: java.io.IOException
Exception in thread "SimpleAsyncTaskExecutor-1" 
org.springframework.amqp.AmqpIOException: java.io.IOException
at 
org.springframework.amqp.rabbit.connection.RabbitUtils.convertRabbitAccessException(RabbitUtils.java:109)
at 
org.springframework.amqp.rabbit.connection.RabbitUtils.closeMessageConsumer(RabbitUtils.java:136)
at 
org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.stop(BlockingQueueConsumer.java:210)
at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.restart(SimpleMessageListenerContainer.java:379)
at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1300(SimpleMessageListenerContainer.java:56)
at 
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:551)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:107)
at com.rabbitmq.client.impl.ChannelN.basicCancel(ChannelN.java:840)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at 
org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:298)
at $Proxy125.basicCancel(Unknown Source)
at 
org.springframework.amqp.rabbit.connection.RabbitUtils.closeMessageConsumer(RabbitUtils.java:123)
... 5 more
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; 
reason: {#method<channel.close>(reply-code=406, 
reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, 
method-id=80),null,""}
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
at 
com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
at 
com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:328)
at com.rabbitmq.client.impl.ChannelN.basicCancel(ChannelN.java:837)
... 12 more



Now, i'm not sure what I need to do to ensure that i'm acknowledging only 
once ? I'm not extremely familiar with spring-rabbit though i've looked 
through the documentation to see if there are any pointers. Can someone 
point me in the right direction ? My spring-rabbit config shown below : 

<rabbit:connection-factory id="connectionFactory" host="${rabbitmq.host:rserver1}" port="${rabbitmq.port:5672}"
    username="guest" password="guest" />

<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />

<rabbit:admin connection-factory="connectionFactory" />

<rabbit:queue name="Q1.${server.name:unknown}"  />
<rabbit:queue name="Q2.${server.name:unknown}"  />

<rabbit:listener-container connection-factory="connectionFactory">
    <rabbit:listener queues="Q2.${server.name:unknown}" ref="q1QueueConsumer" />
    <rabbit:listener queues="Q2.${server.name:unknown}" ref="q2QueueConsumer" />
</rabbit:listener-container>


<rabbit:topic-exchange name="Exchange">

  <rabbit:bindings>
    <rabbit:binding queue="Q1.${server.name:unknown}" pattern="#.Q1.#" />
     <rabbit:binding queue="Q2.${server.name:unknown}" pattern="#.Q2.#" />
  </rabbit:bindings>
</rabbit:topic-exchange>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120601/08612b0e/attachment.htm>


More information about the rabbitmq-discuss mailing list