Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11530

RabbitMQ component doesn't handle network failure properly when using autoAck=false and automaticRecovery=true



    • Bug
    • Status: Resolved
    • Major
    • Resolution: Implemented
    • 2.17.6
    • 2.21.0
    • camel-rabbitmq
    • None
    • RabbitMQ 3.5.7

    • Unknown
    • Regression


      When using autoAck=false and automaticRecoveryEnabled=true on Camel RabbitMQ consumer, we are facing problem during network failure recovery on our production environments.

      Before CAMEL-8742, tested with Camel 2.16.2, the automatic recovery is managed directly by RabbitMQ native client. When network failure is recovering, the old channel is reconnect and messages are proccessed correctly.

      After CAMEL-8742, tested with Camel 2.17.6, the Camel RabbitMQ component open new channel when network failure is recovering. On the other hand, RabbitMQ native client will also reconnect old channels when using automaticRecoveryEnabled=true. So two channel are now open. The two recovery method make conflict. As consequence, new messages publish in RabbitMQ remain unacked and the Camel exchange are not processing on Camel route.

      To recover from this, we should delete, recreate the queue in production environment and restart Camel application. So, the unacked messages are being lost.

      What do you think of this problem ?

      Thank you

      Camel RabbitMQ Consumer Route :

      from("rabbitmq:///?" + 
      		"connectionFactory=#brokerConnectionFactory" + 
      		"&addresses=" + brokerAdresses + 
      		"&queue="+ brokerQueue +
      		"&declare=false" + 
      		"&autoDelete=false" +
      	.bean("<beanName>", "<beanMethod>");

      RabbitMQ Connection Factory with automaticRecoveryEnabled=true

          <bean id="brokerConnectionFactory" class="com.rabbitmq.client.ConnectionFactory">
              <property name="host" value="${broker.hostname}"/>
              <property name="virtualHost" value="${broker.virtualHost:/}"/>
              <property name="port" value="${broker.port:5672}"/>
              <property name="username" value="${broker.username}"/>
              <property name="password" value="${broker.password}"/>
              <property name="automaticRecoveryEnabled" value="true"/>


        1. channel.png
          331 kB
          Arnaud CHOTARD
        2. connections.png
          441 kB
          Arnaud CHOTARD
        3. jmx.png
          96 kB
          Arnaud CHOTARD
        4. queue.png
          179 kB
          Arnaud CHOTARD



            davsclaus Claus Ibsen
            arnaudchotard Arnaud CHOTARD
            0 Vote for this issue
            4 Start watching this issue