I just added an unit test[1] according to your description, I cannot reproduce the error Please check it out and do some modify to see if you can reproduce the error.
[1]http://svn.apache.org/viewvc?rev=1423761&view=rev -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Wednesday, December 19, 2012 at 1:54 AM, semiosis wrote: > Hi all, > > First thank you for camel, it has been a huge help streamlining our > workflows. I'm having trouble with a global exception handler and would > appreciate any help or ideas you have. > > I have a global onException set up before my route, like this... > > onException(Exception.class).handled(false).to("bean:exceptionHandler") > .logStackTrace(true); > > Then I have a route which goes from an aws-sqs consumer to a chain of beans, > like this... > > from(sqsUri + sqsAuth) > .unmarshal(json) > .to("bean:checkin") > .choice() > .when(body().contains( > ProcessA.class.getSimpleName())) > .pipeline("bean:stepA1", > "bean:stepA2", > "bean:stepA3") > .when(body().contains( > ProcessB.class.getSimpleName())) > .pipeline("bean:stepB1", > "bean:stepB2", > "bean:stepB3") > .when(body().contains(Checkin.DUPLICATE)) > .to("bean:duplicateHandler").otherwise() > .to("bean:exceptionHandler"); > > If an exception is thrown in "bean:checkin" my exceptionHandler is invoked > and everything is good. The problem is that if an exception is thrown in > any bean after "bean:checkin" it is silently ignored, not handled by the > global onException. > > I've tried everything I can think of to reduce the complexity here. Even a > simple two-step route behaves the same... > > from(sqsUri + sqsAuth) > .unmarshal(json) > .to("bean:checkin") > .to("bean:duplicateHandler"); > > If an exception is thrown in "bean:duplicateHandler" it's silently ignored, > so it's not an issue with the choice() or pipeline()s. > > It seems that if an exception is thrown anywhere after the first to() then > my global onException is not invoked. > > I've spent two days working on this and I'm out of ideas. What am I doing > wrong? Please help. > > Thank you very much, > > -louis > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/global-onException-only-works-for-first-to-route-item-but-nothing-after-that-tp5724296.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
