Hi All,

I have a question about how to configure time out for camel route
transaction. I am using servicemix 4.4.1 and Camel 2.8.0. I am trying to set
a time out to the transactions used by my camel routes so if any step in
route take too long time, the transaction can roll back and message could be
requeued. I tried to search for a similar use case but failed finding a
clear example. I tried setting a defaulttimeout in transaction manager and
setting a transactionTimeout in jmsComponent, but it didn't work as I
expected. It would be great that someone can help me take a look if I did
anything wrong.

I have my beans.xml file configured as the following:
  <bean id="mkt-jms" class="org.apache.camel.component.jms.JmsComponent">
    <property name="transacted" value="true"/>
    <property name="transactionManager" ref="txManager"/>
    <property name="connectionFactory" ref="jmsConnectionFactory"/>
    <property name="transactionTimeout" value="20000"/>
  </bean>

  <bean id="txManager"
    class="org.springframework.jms.connection.JmsTransactionManager">
    <property name="connectionFactory" ref="jmsConnectionFactory"/>
    <property name="defaultTimeout" value="20"/>
  </bean>
  <bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="vm://mkt-mq"/>
  </bean>

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

I wrote my route as the following, I let the thread sleep for 60 secs in the
sleep function, and was hopping a time out could occurred:

    from("mkt-jms:queue:Mkt.Queue." + getQueueName() + ".Standard")
    .transacted("propagationRequiredPolicy")
    .process(messageProcessor)
    .dynamicRouter(bean(DynamicRouterFileTransfer.class, "sleep"))
    .to("cxf:bean:" + getService())
    );


Thanks a lot.
Tina 



--
View this message in context: 
http://camel.465427.n5.nabble.com/configure-transaction-timeout-in-camel-route-tp5718339.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to