You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kov <ko...@nyc.rr.com> on 2015/09/17 15:02:05 UTC

Can I config a JMS routing app w/multiple PlatformTransactionManagers?

Apologies if this is more of a Spring question than a Camel question.

When I initially tried, I configured one JMS connection-factory per route,
and assigned that connection-factory to the JMS txmgr and the route's
jms-component. But running this throws the following exception:

 java.lang.IllegalArgumentException: Found 2 PlatformTransactionManager in
registry. Cannot determine which one to use. Please configure a
TransactionTemplate on the transacted policy.

So I configured a transaction-policy for each txmgr, but still get that
error. The only way to not get the error is to use just one policy but I
think that effectively selects one txmgr for all the routes.

Does anybody know if there's a way to do this?



--
View this message in context: http://camel.465427.n5.nabble.com/Can-I-config-a-JMS-routing-app-w-multiple-PlatformTransactionManagers-tp5771589.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Can I config a JMS routing app w/multiple PlatformTransactionManagers?

Posted by kov <ko...@nyc.rr.com>.
Thanks, I'd been trying to set the transactionManager property on the JMS
Component initially but still saw the exception. It was setting the
transaction-policy on the route that finally fixed it.

For those interested:

    <route id="A-1">
        <from uri="jms1:q/a" />
        <transacted ref="txpolicy1"/>
        <to uri="jms1:q/b" />
    </route>
    <bean id="txpolicy1"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
        <property name="transactionManager" ref="jmstxmgr1" />
    </bean>
    <bean id="jmstxmgr1"
class="org.springframework.jms.connection.JmsTransactionManager">
        <property name="connectionFactory" ref="jmscf1" />
    </bean>
        <bean id="jmscf1"
class="org.springframework.jms.connection.CachingConnectionFactory">
        
    </bean>
    <bean id="jms1" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="jmscf1" />
        <property name="transactionManager" ref="jmstxmgr1" /> 
        
    </bean>




--
View this message in context: http://camel.465427.n5.nabble.com/Can-I-config-a-JMS-routing-app-w-multiple-PlatformTransactionManagers-tp5771589p5771683.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Can I config a JMS routing app w/multiple PlatformTransactionManagers?

Posted by David Karlsen <da...@gmail.com>.
Either use the transactionMangager configuration parameter:
http://camel.apache.org/jms.html ( notation is #springBeanId to look it up
in the spring registry).
Or configure a transactionpolicy per route, and have the policy refer the
txMgr.

2015-09-17 15:02 GMT+02:00 kov <ko...@nyc.rr.com>:

> Apologies if this is more of a Spring question than a Camel question.
>
> When I initially tried, I configured one JMS connection-factory per route,
> and assigned that connection-factory to the JMS txmgr and the route's
> jms-component. But running this throws the following exception:
>
>  java.lang.IllegalArgumentException: Found 2 PlatformTransactionManager in
> registry. Cannot determine which one to use. Please configure a
> TransactionTemplate on the transacted policy.
>
> So I configured a transaction-policy for each txmgr, but still get that
> error. The only way to not get the error is to use just one policy but I
> think that effectively selects one txmgr for all the routes.
>
> Does anybody know if there's a way to do this?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Can-I-config-a-JMS-routing-app-w-multiple-PlatformTransactionManagers-tp5771589.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen