Hi

What version of Camel do you use?

And see the section _how to get help_ with some pointers what you can do
http://camel.apache.org/support

On Sun, Apr 13, 2014 at 7:41 AM, paulo.neves
<paulo.zagalo.ne...@gmail.com> wrote:
> Hi,I have the follow routes that StartRoute process an Order, splitting itens
> and call direct:processItem route to process itens.
>
> I have an aggregation to aggregate results.
> When processItem route catch an Exception (throw by MyService.class) with
>  .OnException(Exception.class)  .handle(true)  .log("Error on item");
> my aggregation class agregate results (OK) but the code after split never
> run
> .log("split end").log("${body}").process(new ServletProcessor());
> My code:
>  @Component public class StartRoute extends SpringRouteBuilder {        
> @Override
> public void configure() throws Exception {               XPathBuilder xPath =
> xpath("/order/itens/item");                                              
> errorHandler(defaultErrorHandler()
> .maximumRedeliveries(3)                         .redeliveryDelay(1000)
> .retryAttemptedLogLevel(LoggingLevel.ERROR));
> onException(Exception.class)                            .handled(true)
> .log("something wrong");                
> from("cxfrs:bean:rsServer").routeId("startRoute")
> .to("bean:myService?method=process")                .split(xPath, ,new
> MyAggregation())                      .to("direct:processItem")             
> .end()
> .log("split end")                   .log("${body}")                 
> .process(new
> ServletProcessor());    } }
> @Componentpublic class AnotherRoute extends SpringRouteBuilder {        
> @Override
> public void configure() throws Exception {                                    
>           onException(Exception.class)
> .handled(true)                  .log("Error on item");
> from("direct:processItem").routeId("processItemRoute")          
> .log("${body}")
> .bean(MyService.class)           .log("ending route");                  }}
> public class MyAggregation implements AggregationStrategy {     @Override     
>   public
> Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
> if(oldExchange == null) {                       return newExchange;           
>   } else {                        String oldBody =
> oldExchange.getIn().getBody(String.class);                      String 
> newBody =
> newExchange.getIn().getBody(String.class);                                    
>           String catBody =
> oldBody+newBody;                        oldExchange.getIn().setBody(catBody); 
>           }               return
> oldExchange;    }}
> If i remove Aggregation from split or change processItemRoute to use
> Try...catch, everythings works fine.My processItem route with try...catch
> and with that works ok.
> @Componentpublic class AnotherRoute extends SpringRouteBuilder {        
> @Override
> public void configure() throws Exception {
> from("direct:processItem").routeId("processItemRoute")          
> .log("${body}")
> .doTry()                     .bean(MyService.class)             
> .doCatch(Exception.class)
> .log("error")           .doFinally()              .log("ending route")        
>   .end();         }}
> Whats the diference between .onException and try..catch, that second one
> works fine for me?Is there any problem with my aggregation code ?I want to
> use .onException because clean my route code.Thanks,Paulo
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Split-with-Aggregation-when-throw-Exception-issue-tp5750159.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
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to