Despite using a PooledConnectionFactory for my transacted Camel, I still see a new connection being opened into the broker every second.

Solution Verified - Updated -

Issue

I have a transacted Camel route that consumes from ActiveMQ. Something similar to

<camelContext xmlns="http://camel.apache.org/schema/blueprint">
  <route id="route1">
    <from uri="amq:ESB.IN" />
    <transacted ref="required" />
    ...
  </route>

The "activemq" endpoint is configured for transactions and uses a PooledConnectionFactory with only 1 connection:

<bean id="amq" class="org.apache.camel.component.jms.JmsComponent">
  <property name="configuration" ref="AMQConfig" />
</bean>

<bean id="AMQConfig" class="org.apache.camel.component.jms.JmsConfiguration">
  <property name="connectionFactory" ref="PooledCF" />
  <property name="transacted" value="false" />
  <property name="transactionManager" ref="transactionManager" />
  <property name="maxConcurrentConsumers" value="1" />
  <property name="cacheLevelName" value="CACHE_CONSUMER" />
</bean>

<bean id="PooledCF" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
  <property name="connectionFactory" ref="AmqCF" />
  <property name="maxConnections" value="1" />
</bean>

<bean id="AmqCF" class="org.apache.activemq.ActiveMQConnectionFactory">
  <property name="brokerURL" value="failover:(tcp://localhost:61616)?jms.prefetchPolicy.all=1" />
  <property name="userName" value="admin" />
  <property name="password" value="admin" />
</bean>

<bean id="transactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
  <property name="connectionFactory" ref="AmqCF"/>
</bean>

Despite configuring the PooledConnectionFactory for only one connection, a new physical connection is being opened into the broker for every new message.
Should the PooledConnectionFactory not pool and reuse the same existing connection?

Environment

  • Fuse ESB Enterprise 7.x
  • Fuse ESB 4.x
  • Fuse MQ Enterprise 7.x
  • Fuse MQ 5.x
  • JBoss Fuse 6.0
  • Fuse Mediation Router

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