Using Camel ActiveMQ component to send messages causes many TCP connections to be reestablished

Solution Verified - Updated -

Issue

With a camel route like that below, we see many TCP connections being created and torn down to mq-broker2

<camelContext id="transactionTestContext" xmlns="http://camel.apache.org/schema/blueprint">

       <route>
           <from uri="mq-tx-broker1:queue:input?acknowledgementModeName=SESSION_TRANSACTED&amp;disableReplyTo=true&amp;preserveMessageQos=true&amp;concurrentConsumers=1&amp;maxConcurrentConsumers=1&amp;IdleTaskExecutionLimit=1&amp;maxMessagesPerTask=1"/>
           <to uri="log:com.example.mq?level=DEBUG&amp;showExchangeId=true&amp;showProperties=true&amp;showHeaders=true&amp;showException=true&amp;showBody=false" id="to8"/>
           <to uri="mq-broker2:queue:output.GW02?preserveMessageQos=true&amp;includeSentJMSMessageID=true" id="to9"/>
       </route>

    </camelContext>

    <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:61610"/>
        <property name="userName" value="admin" />
        <property name="password" value="admin" />
    </bean>

    <bean id="mq-tx-broker1-config"
          class="org.apache.activemq.camel.component.ActiveMQConfiguration">
        <property name="connectionFactory" ref="jmsConnectionFactory" />
        <property name="transacted" value="true" />
        <property name="cacheLevelName" value="CACHE_CONSUMER" />
    </bean>

    <bean id="mq-tx-broker1" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="configuration" ref="mq-tx-broker1-config" />
    </bean>

    <!-- setup camel-jms broker 2 -->

    <bean id="mq-broker2-config"
          class="org.apache.activemq.camel.component.ActiveMQConfiguration">
        <property name="brokerURL" value="tcp://localhost:61618" />
        <property name="userName" value="admin" />
        <property name="password" value="admin" />
        <property name="cacheLevelName" value="CACHE_CONNECTION" />
    </bean>

    <bean id="mq-broker2" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="configuration" ref="mq-broker2-config" />
    </bean>

Environment

JBoss A-MQ 6.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.