Mark de Leon created CAMEL-11480:
------------------------------------

             Summary: camel-rabbitmq - autorecovery creates additional channels
                 Key: CAMEL-11480
                 URL: https://issues.apache.org/jira/browse/CAMEL-11480
             Project: Camel
          Issue Type: Bug
          Components: camel-rabbitmq
    Affects Versions: 2.19.1
         Environment: rabbitmq server 3.6.2 running on cluster+HA mode (2 
nodes), Spring client application using DSL camel configuration
            Reporter: Mark de Leon
            Priority: Minor


While testing the automatic recovery for rabbitmq for network failure scenario, 
I noticed that after recovery, the consumer/channel count is always increasing.

Consider the following codes:
<camel:route id="in_route">
                        <camel:from 
uri="rabbitmq://rabbitmq/myexchange?connectionFactory=#rabbitMqCustomConnectionFactory&amp;addresses={{rabbitmq.nodes}}&amp;queue=myqueue"
 />
                        <camel:to uri="log:message received?showBody=true" />
                </camel:route>

// Custom connection factory
<bean id="rabbitMqCustomConnectionFactory" 
class="com.rabbitmq.client.ConnectionFactory">
        <property name="username" value="${rabbitmq.username}" />
        <property name="password" value="${rabbitmq.password}" />
</bean>

When the application runs, I see 2 threads running:
* RabbitMQConsumer [camel-rabbitmq library]
* AMQConnection (RecoveryAwareAMQConnection) [amqp-client]

Killing the active rabbitmq server node triggers the auto recovery in the 
client.
* RabbitConsumer.handleShutdownSignal() successfully reconnects to the other 
rabbitmq node. 
* At the same time, AutorecoveringConnection.beginAutomaticRecovery is 
triggered but with some networkRecoveryInterval delay - recovers successfully 
any existing channels.

As a result, 2 channels/consumers are created - both are active. When there 
should only be 1 channel to be recovered.

Would it be possible to add a priority whether which recovery mechanism to use? 
Was thinking of having the AMQConnection recovery execute first before the 
RabbitConsumer recovery since the latter checks if an existing channel is open 
before creating a new connection.



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

Reply via email to