If route2 needs to execute after route1 finishes, and route1 doesn't use
the response from route2, you should be creating a parent route that calls
route1 and then route2 in sequential order using a pipeline:

<route>
   <from uri="..." />
   <to uri="direct:route1" />
   <to uri="direct:route2" />
</route>

Then route1 will commit the transaction before Camel invokes route2.

I'm not sure how solid the isolation level approach is, I guess it depends
on the DB. From what I read on Wikipedia: "... so one transaction *may* see
not-yet-committed changes made by other transactions", i.e. it may or it
may not read the dirty value, there's could be no guarantee.

Also, if you are going through the effort of using transactions to begin
with, you probably don't want route2 to use a value changed by route1 which
is still in risk of potential rollback.

Regards,

*Raúl Kripalani*
Apache Camel Committer
Enterprise Architect, Program Manager, Open Source Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk <http://twitter.com/raulvk>

On Wed, Oct 3, 2012 at 4:05 PM, lolo <laurent.gaert...@lchclearnet.com>wrote:

> Those two routes cannot be asynchronous, because I want route 2 to be
> called
> only when route 1 is finished.
>
> Route 2 is defined as:
> from("direct:startTransform").routeId("route2").
>
>
> onException(Exception.class).process(exceptionProcessor).markRollbackOnlyLast().end().
>      transacted("PROPAGATION_REQUIRES_NEW").
>       .....
>
> Route 1 calls route 2 like the following:
>      to("direct:startTransform");
>
> I would like the two routes to be in different transactions because if an
> Exception is thrown in route 2 I do not want route 2 to rollback
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Two-routes-two-transactions-tp5720484p5720491.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>

Reply via email to