Arnaud CHOTARD created CAMEL-11530:
--------------------------------------

             Summary: RabbitMQ component doesn't handle network failure 
properly when using autoAck=false and automaticRecovery=true
                 Key: CAMEL-11530
                 URL: https://issues.apache.org/jira/browse/CAMEL-11530
             Project: Camel
          Issue Type: Bug
          Components: camel-rabbitmq
    Affects Versions: 2.17.6
         Environment: RabbitMQ 3.5.7
            Reporter: Arnaud CHOTARD
         Attachments: channel.png, connections.png, jmx.png, queue.png

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 :
{code:java}
from("rabbitmq:///?" + 
                "connectionFactory=#brokerConnectionFactory" + 
                "&addresses=" + brokerAdresses + 
                "&queue="+ brokerQueue +
                "&declare=false" + 
                "&autoDelete=false" +
                "&autoAck=false"
        )
        .bean("<beanName>", "<beanMethod>");
{code}

RabbitMQ Connection Factory with automaticRecoveryEnabled=true
{code}
    <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"/>
    </bean>
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to