-
1. Re: Camel RouteBuilder onException statement
splatch Jul 30, 2012 8:50 AM (in response to edevera)Hey Eduardo,
Because current support for Camel in Switchyard implementation.camel is limited to route elements you have to put onException definition inside route element:
from("switchyard://service") .onException(...) .end() .to("switchyard://reference")
-
2. Re: Camel RouteBuilder onException statement
edevera Jul 30, 2012 9:35 AM (in response to splatch)So, if I add the onException right after the from call, are all the services candidates of being called that throw the specified exception treated? That would allow me to only define it once which is what I was considering by doing what I have asked.
Thanks!
-
3. Re: Camel RouteBuilder onException statement
splatch Jul 30, 2012 9:40 AM (in response to edevera)You can add multiple onException definitions inside route - just like you do inside route builder/camel context. The main difference is scope of onException closure. The onException part is called only if you have matching exception thrown somewhere in route. The normal (correct) flow skips onException execution.
-
4. Re: Camel RouteBuilder onException statement
edevera Aug 2, 2012 9:15 AM (in response to splatch)Hi Lukasz,
I have managed to have global exception handling defined once only by doing this:
public void configure() { onException(MyException.class) .maximumRedeliveries(3) .to(myDeadLetterEndpoint); from("switchyard:...")... }
Which is what I originally intended and works like a charm.
Thanks a lot for your help!