On Tue, May 8, 2012 at 9:18 AM, priya <[email protected]> wrote:
> Hi,
> Thanks for the reply.We are able to achieve the complete Exchange rollback
> by shareUnitOfWork option on splitter with camel-core-9.2.0 when an
> exception occurs during unmarshalling. And further spillting of exchange
> stops.But all the exchange's before unmarshaller exception still aggregates
> and invokes my endpoint("direct:sub")  which takes care of DB Insertions.I
> want to achieve rollback of these exchange from DB as well.
> Note: I am able to rollback the DB insertions in case of any SQL exception
> using transacted().
>
> My current route now looks like
> from( "seda:xyz”)
>  .onException(Exception.class).maximumRedeliveries(0).rollback()
>  .end()
> .transacted()
>  .split(new SplitterExpression(inputFile)).shareUnitOfWork()
>        .streaming()
>        .stopOnException()
>        .transform( new Unmarshaller()) .aggregate(aggregationStrategy)
>                .completionSize(10)
>                .completionTimeout(2000)
>                .eagerCheckCompletion()
>        .to("direct:sub”)
>
> from("direct:sub")
>  .transacted()
>       .choice()
>       .when(condition1).process( new myBean(myDAO))
>        .when(condition2).process(new myBean1(myDAO))
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Unable-to-rollback-exchange-while-unmarshalling-a-file-tp5666851p5692877.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

You cannot do one giant atomic transaction with multiple threads. This
is not supported by Spring TX manager et all.
eg in your use-case the aggregate EIP will use different threads than
the splitter etc.

The splitter EIP in Camel has built-in support for aggregation. Then
it can act as a composed message processor. See:
http://camel.apache.org/composed-message-processor.html
http://camel.apache.org/splitter


-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to