camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Anderson <a...@frontlinesms.com>
Subject Re: [2.9.5] body=null after onException(_).handled(false)
Date Wed, 06 Feb 2013 09:37:57 GMT
On 5 February 2013 18:39, Henryk Konsek <hekonsek@gmail.com> wrote:
> Hi Alex,
>
>> When myBean.slip() throws SpecificException, If I print in.body in
>> handleSpecificException(), I can see that it is not null.
>>
>> If I print it again in handleFailed() it is now null.
>
> Actually I can't reproduce this problem neither under Camel 2.9.5 nor
> under Camel 2.10.1.
>
> Here is my minimal example trying to reproduce your behavior:
>
> ______________
> public class ErrorHandler {
>
>   public void exception(Exchange exchange) {
>     System.out.println("Exception: " + exchange.getIn());
>   }
>
>   public void completion(Exchange exchange) {
>     System.out.println("Completion: " + exchange.getIn());
>   }
>
>   public void router() {
>     throw new RuntimeException();
>   }
>
> }
>
> CamelContext context = new DefaultCamelContext();
> context.addRoutes(new RouteBuilder() {
>   @Override
>   public void configure() throws Exception {
>     onCompletion().onFailureOnly().bean(new ErrorHandler(), "completion");
>     from("seda:start")
>        .onException(Exception.class)
>        .bean(new ErrorHandler(), "exception")
>        .handled(false)
>        .end()
>     .dynamicRouter(bean(ErrorHandler.class, "router"));
>     }
>   });
> context.start();
> context.createProducerTemplate().sendBody("seda:start","msg");
> ______________
>
> The output produced by it indicates that both handlers work fine:
>
> ______________
> Exception: Message: msg
> Completion: Message: msg
> ______________
>
> If you would be so kind and create minimal Maven project with test
> case demonstrating the issue, I could debug it and tell you what is
> the problem.

Hi Henryk,

Thanks for your help.  I agree that your example doesn't exhibit the
problem - I'm sorry for not working through a simple example myself
before sending to the mailing list.

When I have time I will try to recreate and share on this list.

Alex

Mime
View raw message