Hi

You cannot do this using onCompletion. For 2 different TX in the same
unit of work, you can use the propagation behaviors with REQUIRES_NEW
to start a new TX for the 2nd part.

This use-case is covered in Camel in Action book from page 305 onwards.

On Thu, Aug 1, 2013 at 11:59 PM, dsemenov <sdo.seme...@gmail.com> wrote:
> Hello colleagues
>
> I have a simple route
>
> <camel:camelContext id="upstream-entries">
>         <camel:route>
>             <camel:from
> uri="execMqOet:PWJMQM.GOM.GOMJULINT.DEV2?disableReplyTo=true"/>
>             <camel:onCompletion>
>                 <camel:to "direct:separate_tx_route" />
>                 <camel:log message="in on completion" />
>             </camel:onCompletion>
>             <camel:transacted ref="PROPAGATION_REQUIRED"/>
>             <camel:to uri="sql:INSERT INTO DISASTER values
> (SEQ_TFI_TRADE_STATUS.NEXTVAL, #)?dataSourceRef=xaDataSource"/>
>         </camel:route>
>     </camel:camelContext>
>
> execMqOet is a transactional jms consumer which starts XA transaction.
> I need to start another transaction in direct:separate_tx_route but it
> should be started only if transaction finished in parent route.
>
> After some investigation i've found that onCompletion starts in another
> thread (which is fine), when exchange is completed. But this doesn't mean
> that transaction in parent route committed as well.
>
> How can i synchronize on completion block with transaction commit in parent
> route?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Start-new-route-after-transaction-completed-tp5736661.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to