Posting this to users@camel since it may be more appropriate

On Thu, May 12, 2011 at 1:04 PM, janne postilista
<[email protected]> wrote:
> 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" />
> </bean>
>
>    <route>
>      <from uri="activemq://queue-a" />
>      <transacted ref="required"/>
>      <process ref="myProcessor" />
>      <from uri="activemq://queue-a" />
>    </route>
>
> 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"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>    <property name="transacted" value="true" />
>    <property name="transactionManager" ref="txManager" />
>    <property name="connectionFactory" ref="jmsConnectionFactory" />
>  </bean>
>  <bean id="txManager"
>    class="org.springframework.jms.connection.JmsTransactionManager">
>    <property name="connectionFactory" ref="jmsConnectionFactory" />
>  </bean>
>  <bean id="jmsConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>    <property name="brokerURL" value="${activemq.brokerurl}" />
>  </bean>
>

Reply via email to