Hi My mind must have tricked me today. It works nice out-of-the-box. Just remember to use .end() for onException within routes.
I am currently updating the exception clause wiki page. There is one caveat left and that is when you have *both* - per route exception clause - per route error handler - AND global exception clauses So this is a very advanced use-case I doubt that many end-users use. It do works, however the nested error handler will also inherit the global exception clauses and that can maybe take some end users by surprise. See some of the new unit tests: http://svn.apache.org/viewvc?view=rev&revision=730985 On Sat, Jan 3, 2009 at 11:15 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > I created a ticket for it > https://issues.apache.org/activemq/browse/CAMEL-1218 > > On Sat, Jan 3, 2009 at 11:11 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: >> Hi >> >> Okay I was a bit to jumpy before. I have digged into it a bit more. >> >> onException is global per route context. The current codebase doens't >> support nested sub route onException. >> >> So even though you in the DSL can add .onException in that particular >> route they are globally. Peeking at the code I think it would be a bit >> to complex to refactor the code to allow for per route onException >> currently. It's kinda advanced code already. >> >> So we might wanna retrofit the DSL to only allow onException at a global >> level. >> >> >> >> On Sat, Jan 3, 2009 at 10:02 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: >>> Hi >>> >>> Okay I had a quick peak and it looks good in Java DSL. Will try spring >>> DSL later. >>> >>> As you are using sub routing with onException you need to indicate >>> when it stops using .end() >>> >>> So it should be like this with .end() when you want the onException to stop. >>> from("somewhere") >>> >>> .onException(IllegalArgumentException.class).maximumRedeliveries(0).end() >>> .to("someplace") >>> >>> And I guess I need to update the wiki with this. ;) >>> >>> >>> >>> On Tue, Dec 2, 2008 at 5:36 PM, Martin Gilday <martin.li...@imap.cc> wrote: >>>> I've attempted what Claus suggested on putting onException in a route >>>> >>>> from("somewhere").onException(IllegalArgumentException.class).maximumRedeliveries(0).to("someplace") >>>> >>>> Camel allows this to start up but it appears to have no affect and >>>> routes simply time out. >>>> >>>> Can anyone comment on whether this is valid? >>>> http://activemq.apache.org/camel/exception-clause.html makes no mention >>>> of if this should be permitted on not. >>>> >>>> Thanks, >>>> Martin. >>>> >>>> >>>> ----- Original message ----- >>>> From: "Martin Gilday" <martin.li...@imap.cc> >>>> To: camel-user@activemq.apache.org >>>> Date: Wed, 26 Nov 2008 14:59:34 +0000 >>>> Subject: onException for a particular route >>>> >>>> Reading through the docs there is an explanation of how to use >>>> onException to set error handling for the global context. There is also >>>> instructions on how to set up an errorHandler for a particular route. >>>> Is it possible to set up onException handlers that only apply to an >>>> individual or subset of routes? deadLetterChannelBuilder has method >>>> named exceptionPolicyStrategy which may be what I am after. Could >>>> someone point me in the direction of a code snippet of how to use this? >>>> >>>> Thanks, >>>> Martin. >>>> >>> >>> >>> >>> -- >>> >>> /Claus Ibsen >>> Apache Camel Committer >>> Blog: http://davsclaus.blogspot.com/ >>> >> >> >> >> -- >> >> /Claus Ibsen >> Apache Camel Committer >> Blog: http://davsclaus.blogspot.com/ >> > > > > -- > > /Claus Ibsen > Apache Camel Committer > Blog: http://davsclaus.blogspot.com/ > -- /Claus Ibsen Apache Camel Committer Blog: http://davsclaus.blogspot.com/