You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by andrericos <an...@gmail.com> on 2014/07/01 01:46:15 UTC

Re: OnCompletion and rollbacked transaction.

Well... 

I tried to find where the camel stops to compute the route and I found this
code in RedeliveryErrorHandler.java:

// compute if we are exhausted, and whether redelivery is 
boolean exhausted = isExhausted(exchange, data);
boolean redeliverAllowed = isRedeliveryAllowed(data);
// if we are exhausted or redelivery is not allowed, then deliver to failure
processor (eg such as DLC)
if (!redeliverAllowed || exhausted) {

After that Camel stops my route.

So, I tried to do my bean execute before the route was marked to
ROLLBACK_ONLY.
Using pipeline inside the onException I could do that:

...
.onCompletion() 
             .bean(this.logCompletionRoute) 
.end() 
.onException(Exception.class) 
            .handled(true)
            *.pipeline()
                .log(LoggingLevel.ERROR, this.log, "Error on processing
message. Sending Rollback command!") 
                .log(LoggingLevel.ERROR, this.log,
"${exception.stacktrace}") 
                .bean(this.logCompletionRoute)
            .end()*
            .rollback()
.end()
...


Is there some more elegant solution?

Thanks

André Souza



--
View this message in context: http://camel.465427.n5.nabble.com/OnCompletion-and-rollbacked-transaction-tp5753080p5753088.html
Sent from the Camel - Users mailing list archive at Nabble.com.