camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <ch0...@gmail.com>
Subject Re: configure transaction timeout in camel route
Date Thu, 30 Aug 2012 09:36:34 GMT
Tina,

According to Spring documentation, the TransactionTimeOut should be in
second

http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#AbstractPollingMessageListenerContainer.setTransactionTimeout%28int%29

Specify the transaction timeout to use for transactional wrapping, in *
seconds*. Default is none, using the transaction manager's default timeout.

See also:org.springframework.transaction.TransactionDefinition.getTimeout()
setReceiveTimeout

168 <http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#168>

<http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#>

169 <http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#169>

<http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#>

	public void  <http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#>setTransactionTimeout(int
transactionTimeout) {

170 <http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#170>

<http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#>

		this.transactionDefinition
<http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#AbstractPollingMessageListenerContainer.0transactionDefinition>.setTimeout
<http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-tx/2.5.6/org/springframework/transaction/support/DefaultTransactionDefinition.java#DefaultTransactionDefinition.setTimeout%28int%29>(transactionTimeout);

171 <http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#171>

<http://grepcode.com/file/repo1.maven.org/maven2/org.springframework/spring-jms/2.5.6/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java#>

	}


Regards,



On Thu, Aug 30, 2012 at 11:31 AM, Charles Moulliard <ch007m@gmail.com>wrote:

> Hi Tina,
>
> Can you verify that a Transaction is well created by spring when a message
> is consumed from the queue ? As the property transactionTimeout has been
> defined on the camel JMS component, this property is set on the
> DefaultMessageListenerContainer of Spring which should take care about this
> timeout
>
> Regards,
>
>
>
> On Thu, Aug 30, 2012 at 3:31 AM, Tianchi <tinali612@gmail.com> wrote:
>
>> 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.
>>
>
>
>
> --
> Charles Moulliard
> Apache Committer / Sr. Pr. Consultant at FuseSource.com
> Twitter : @cmoulliard
> Blog : http://cmoulliard.blogspot.com
>
>


-- 
Charles Moulliard
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Twitter : @cmoulliard
Blog : http://cmoulliard.blogspot.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message