[
https://issues.apache.org/activemq/browse/CAMEL-668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43980#action_43980
]
davsclaus edited comment on CAMEL-668 at 7/5/08 4:53 AM:
-----------------------------------------------------------
You can now do
{code}
<!-- policy for required transaction used in our Camel routes -->
<bean id="PROPAGATION_REQUIRED"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="txManager"/>
</bean>
{code}
And use it in Java DSL directly
{code}
SpringTransactionPolicy required = context.getRegistry()
.lookup("PROPAGATION_REQUIRED",
SpringTransactionPolicy.class);
...
from("xxxx").policy(required).to("yyyy");
{code}
Or you can avoid the lookup code above and use the bean DSL to lookup the
spring bean
{code}
from("xxxx").policy(bean(Policy.class, "PROPAGATION_REQUIRED")).to("yyyy");
{code}
was (Author: davsclaus):
You can now do
{code}
<!-- policy for required transaction used in our Camel routes -->
<bean id="PROPAGATION_REQUIRED"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="txManager"/>
</bean>
{code}
And use it in Java DSL directly
{code}
SpringTransactionPolicy required = context.getRegistry()
.lookup("PROPAGATION_REQUIRED",
SpringTransactionPolicy.class);
...
from("xxxx").policy(required).to("yyyy");
{code}
Or you can avoid the lookup code above and use the bean DSL to lookup the
spring bean
{code}
from("xxxx").policy(bean(Policy.class, "PROPAGATION_REQUIRED").to("yyyy");
{code}
> Transactional Client - Setting Spring Policy is a bit cumbersome in the XML
> ---------------------------------------------------------------------------
>
> Key: CAMEL-668
> URL: https://issues.apache.org/activemq/browse/CAMEL-668
> Project: Apache Camel
> Issue Type: Improvement
> Affects Versions: 1.4.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 1.4.0
>
>
> Currently you have to setup the transaction demarcation in the spring xml
> file as:
> {code}
> <bean id="PROPAGATION_REQUIRED"
> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
> <constructor-arg>
> <bean
> class="org.springframework.transaction.support.TransactionTemplate">
> <property name="transactionManager"
> ref="jmsTransactionManager"/>
> </bean>
> </constructor-arg>
> </bean>
> {code}
> to be able to use the policy from XML directly in the tag:
> {code}
> <camel:policy ref="PROPAGATION_REQUIRED"/>
> {code}
> We should support a neater syntax without the nested bean and constructor
> args.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.