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

camel-rabbitmq - autorecovery creates additional channels

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.19.1
    • 2.20.0
    • camel-rabbitmq
    • None
    • rabbitmq server 3.6.2 running on cluster+HA mode (2 nodes), Spring client application using DSL camel configuration

    • Moderate

    Description

      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&addresses=rabbitmq.nodes&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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              macdln Mark de Leon
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: