Transactional JMS Route Opening/Closing Connections I would like to setup a route that utilizes transactional delivery of JMS messages to avoid dropping messages in the event of server failures. To do this I have utilized the Camel Transaction documentation to set up transactional routes (Camel version 2.2). This Camel Engine is running within ActiveMQ (5.3.1) to do some lightweight processing/routing/mediation of messages. Here is the camel configuration:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="jmstx:example.A"/> <to uri="jmstx:example.B"/> </route> </camelContext> <!-- JmsComponent Transactional Delivery of JMS Messages --> <bean id="jmstx" class="org.apache.camel.component.jms.JmsComponent"> <property name="configuration" ref="jmsConfig" /> </bean> <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration"> <property name="connectionFactory" ref="jmsConnectionFactory"/> <property name="transactionManager" ref="jmsTransactionManager"/> <property name="transacted" value="true"/> </bean> <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager"> <property name="connectionFactory" ref="jmsConnectionFactory" /> </bean> <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="vm://localhost?create=false&waitForStart=10000" /> <property name="userName" value="${activemq.username}" /> <property name="password" value="${activemq.password}" /> </bean> </beans> Before I even send any messages through this route I receive the following opening/closing of connetions (logging at Debug level): 2010-04-21 13:38:18,387 | DEBUG | Setting up new connection id: ID:tbarneswin7-60077-1271882288129-2:8, address: vm://localhost#14 | org.apache.activemq.broker.TransportConnection | VMTransport: vm://localhost#15 2010-04-21 13:38:18,387 | DEBUG | localhost adding consumer: ID:tbarneswin7-60077-1271882288129-2:8:-1:1 for destination: topic://ActiveMQ.Advisory.TempQueue,topic://ActiveMQ.Advisory.TempTopic | org.apache.activemq.broker.region.AbstractRegion | VMTransport: vm://localhost#15 2010-04-21 13:38:19,392 | DEBUG | ID:tbarneswin7-60077-1271882288129-2:8:1 Transaction Commit :null | org.apache.activemq.ActiveMQSession | DefaultMessageListenerContainer-1 2010-04-21 13:38:19,393 | DEBUG | localhost removing consumer: ID:tbarneswin7-60077-1271882288129-2:8:-1:1 for destination: topic://ActiveMQ.Advisory.TempQueue,topic://ActiveMQ.Advisory.TempTopic | org.apache.activemq.broker.region.AbstractRegion | VMTransport: vm://localhost#15 2010-04-21 13:38:19,393 | DEBUG | remove connection id: ID:tbarneswin7-60077-1271882288129-2:8 | org.apache.activemq.broker.TransportConnection | VMTransport: vm://localhost#15 2010-04-21 13:38:19,395 | DEBUG | Stopping connection: vm://localhost#14 | org.apache.activemq.broker.TransportConnection | ActiveMQ Task 2010-04-21 13:38:19,395 | DEBUG | Stopped transport: vm://localhost#14 | org.apache.activemq.broker.TransportConnection | ActiveMQ Task 2010-04-21 13:38:19,408 | DEBUG | Setting up new connection id: ID:tbarneswin7-60077-1271882288129-2:9, address: vm://localhost#16 | org.apache.activemq.broker.TransportConnection | VMTransport: vm://localhost#17 2010-04-21 13:38:19,409 | DEBUG | Connection Stopped: vm://localhost#14 | org.apache.activemq.broker.TransportConnection | ActiveMQ Task 2010-04-21 13:38:19,409 | DEBUG | localhost adding consumer: ID:tbarneswin7-60077-1271882288129-2:9:-1:1 for destination: topic://ActiveMQ.Advisory.TempQueue,topic://ActiveMQ.Advisory.TempTopic | org.apache.activemq.broker.region.AbstractRegion | VMTransport: vm://localhost#17 2010-04-21 13:38:20,411 | DEBUG | ID:tbarneswin7-60077-1271882288129-2:9:1 Transaction Commit :null | org.apache.activemq.ActiveMQSession | DefaultMessageListenerContainer-1 2010-04-21 13:38:20,411 | DEBUG | localhost removing consumer: ID:tbarneswin7-60077-1271882288129-2:9:-1:1 for destination: topic://ActiveMQ.Advisory.TempQueue,topic://ActiveMQ.Advisory.TempTopic | org.apache.activemq.broker.region.AbstractRegion | VMTransport: vm://localhost#17 2010-04-21 13:38:20,412 | DEBUG | remove connection id: ID:tbarneswin7-60077-1271882288129-2:9 | org.apache.activemq.broker.TransportConnection | VMTransport: vm://localhost#17 2010-04-21 13:38:20,413 | DEBUG | Stopping connection: vm://localhost#16 | org.apache.activemq.broker.TransportConnection | ActiveMQ Task 2010-04-21 13:38:20,414 | DEBUG | Stopped transport: vm://localhost#16 | org.apache.activemq.broker.TransportConnection | ActiveMQ Task 2010-04-21 13:38:20,415 | DEBUG | Connection Stopped: vm://localhost#16 | org.apache.activemq.broker.TransportConnection | ActiveMQ Task 2010-04-21 13:38:20,416 | DEBUG | Setting up new connection id: ID:tbarneswin7-60077-1271882288129-2:10, address: vm://localhost#18 | org.apache.activemq.broker.TransportConnection | VMTransport: vm://localhost#19 Is there some mis-configuration that I am doing that causes these JMS connections to be opened/closed constantly? Should I utilize another method to create these Camel Routes? Any suggestions or recommendations are appreciated. Here is the actual camel file used to isolate the problem: http://old.nabble.com/file/p28836324/camel.xml camel.xml -- View this message in context: http://old.nabble.com/Transactional-JMS-Route-Constantly-Opening-Closing-Connections-tp28836324p28836324.html Sent from the Camel - Users mailing list archive at Nabble.com.