On Thu, Jun 4, 2009 at 11:09 PM, dcheckoway<[email protected]> wrote:
>
> I finally got it t work as expected, but here was the deal...
>
>  <bean id="jmsTransactionManager"
>        class="org.springframework.jms.connection.JmsTransactionManager">
>    <property name="connectionFactory" ref="jmsConnectionFactory" />
>  </bean>
>
>  <bean id="jmsConfig"
>        class="org.apache.camel.component.jms.JmsConfiguration">
>    <property name="connectionFactory" ref="jmsConnectionFactory"/>
>    <property name="transactionManager" ref="jmsTransactionManager"/>
>    <property name="transacted" value="true"/>
>  </bean>
>
>  <bean id="activemq"
>        class="org.apache.activemq.camel.component.ActiveMQComponent">
>    <property name="configuration" ref="jmsConfig"/>
>  </bean>
>
> If I removed the "transacted=true" from the activemq component's jmsConfig
> (or set it to false), then it works as expected.  Messages are queued as
> they are "sent".
>
> But maybe somebody can help explain to me what the difference is.  Does that
> mean all of my sends are no longer transactional?  Are transactional sends
> even important?  I'm struggling to wrap my head around why I would or
> wouldn't want sends to be transactional.
It all depends on your use case.

I was thinking on the line maybe you could use spring transaction
demarcation using REQUIRES_NEW
when sending the messages using the producer template.

You can just create a new route that does this

from direct:foo
   policy (requires new)
   to (jms queue foo)

And maybe the original route can be transacted as well.

Or the 2nd route can use NO TX at all

from direct:foo
   policy (none)
   to (jms queue foo)

Or you can configure a 2nd AMQ client in the Spring XML file that has
transacted=false and use it for sending.

But ask at the AMQ forum as they get this kind of questions more often.



> --
> View this message in context: 
> http://www.nabble.com/How-to-control-transactions-when-already-in-a-transaction-tp23873683p23877773.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to