camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From janne postilista <>
Subject Do I need to use <transacted> in my JMS route or is it transactional regardless?
Date Thu, 12 May 2011 10:11:11 GMT
I'm configuring my route (jms queue A -> some processing -> jms queue
B) to be transactional. My route looks like:

<bean id="required" class="org.apache.camel.spring.spi.SpringTransactionPolicy">
 <property name="transactionManager" ref="txManager" />
 <property name="propagationBehaviorName" value="PROPAGATION_REQUIRED" />

     <from uri="activemq://queue-a" />
     <transacted ref="required"/>
     <process ref="myProcessor" />
     <from uri="activemq://queue-a" />

connection factories etc. configuration at the end of this post. I
followed examples from Camel In Action chapter 9.

I test that my transactions work as:

1. modified myProcessor so that it takes a long time (Thread.sleep(1000000))
2. send message to queue-a
3. while message is being processed by myProcessor, kill servicemix
(and camel inside)
4. check if the message exists in the queue-a or if it has been lost

When I have the <transacted ref="required"/> there, it works as I
expect it, message stays in the ActiveMQ pending messages.

But when I remove <transacted ref="required"/> the route still seems
to be transactional and the message is not lost. Why is that? Can I
just forget <transacted/> in all of my routes? ActiveMQComponent bean
has definition <property name="transacted" value="true" />, is this
the cause?

ActiveMQ / JMS definitions:

 <bean id="activemq"
   <property name="transacted" value="true" />
   <property name="transactionManager" ref="txManager" />
   <property name="connectionFactory" ref="jmsConnectionFactory" />
 <bean id="txManager"
   <property name="connectionFactory" ref="jmsConnectionFactory" />
 <bean id="jmsConnectionFactory"
   <property name="brokerURL" value="${activemq.brokerurl}" />

View raw message