You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by s_albrecht <St...@icw.de> on 2012/01/27 09:01:03 UTC

Exception Handling with Subroutes incl. Splits

Hi All,

I am using camel 2.8.1 and want to do the following:
- Route A calls Route B (via direct endpoint)
- Route B does some error handling like - completely handling exception,
converting exception to another type and throw the converted, let exception
through
- Route A adds some more error handling: handle the exceptions, which have
been let through by route B or those, which have been converted by route B
from another exception

I have found no way to do this, is this possible at all, and if yes, how to
accomplish that ?

Another thing: If an exception occurs within a split block, I see that
splitting continues, that is, the split block is executed with the next
element. How do I break this, so that once an exception occurs the initial
exchange is not splitted further ?

--
View this message in context: http://camel.465427.n5.nabble.com/Exception-Handling-with-Subroutes-incl-Splits-tp5434732p5434732.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Exception Handling with Subroutes incl. Splits

Posted by s_albrecht <St...@icw.de>.
> You can use route scoped onException to handle exceptions differently,
> between the routes.

No, that does not work. I forgot to mention that the 2 routes are separated
into 2 route builders. It seems to me that only the error handling of the
sub route is active and all the onException configuration within the 'super'
route (in another route builder) is simply ignored. I attached a source code
file, which illustrates the setup I have in mind.

http://camel.465427.n5.nabble.com/file/n5435303/onexceptiontest.zip
onexceptiontest.zip 



--
View this message in context: http://camel.465427.n5.nabble.com/Exception-Handling-with-Subroutes-incl-Splits-tp5434732p5435303.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Exception Handling with Subroutes incl. Splits

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jan 27, 2012 at 9:11 AM, s_albrecht <St...@icw.de> wrote:
> ok, thanks and sorry for this, I missed that option. Is there an easy
> solution for the first part of my question as well ?
>

You can use route scoped onException to handle exceptions differently,
between the routes.


> --
> View this message in context: http://camel.465427.n5.nabble.com/Exception-Handling-with-Subroutes-incl-Splits-tp5434732p5434745.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Exception Handling with Subroutes incl. Splits

Posted by s_albrecht <St...@icw.de>.
ok, thanks and sorry for this, I missed that option. Is there an easy
solution for the first part of my question as well ?

--
View this message in context: http://camel.465427.n5.nabble.com/Exception-Handling-with-Subroutes-incl-Splits-tp5434732p5434745.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Exception Handling with Subroutes incl. Splits

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jan 27, 2012 at 9:01 AM, s_albrecht <St...@icw.de> wrote:
> Hi All,
>
> I am using camel 2.8.1 and want to do the following:
> - Route A calls Route B (via direct endpoint)
> - Route B does some error handling like - completely handling exception,
> converting exception to another type and throw the converted, let exception
> through
> - Route A adds some more error handling: handle the exceptions, which have
> been let through by route B or those, which have been converted by route B
> from another exception
>
> I have found no way to do this, is this possible at all, and if yes, how to
> accomplish that ?
>
> Another thing: If an exception occurs within a split block, I see that
> splitting continues, that is, the split block is executed with the next
> element. How do I break this, so that once an exception occurs the initial
> exchange is not splitted further ?
>

Read the documentation. See the Splitter EIP
http://camel.apache.org/splitter

There is an option to stop on exception.


> --
> View this message in context: http://camel.465427.n5.nabble.com/Exception-Handling-with-Subroutes-incl-Splits-tp5434732p5434732.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/