exception handling across routes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

exception handling across routes

Minh Tran
Hi

I'm attempting to catch an exception thrown from another route as follows.

<route>
        <from uri="direct:one"/>
        <onException>
                <exception>BlahException</exception>
                <handled>
                        <constant>true</constant>
                </handled>
                <to message="handled blah"/>
        </onException>
        <to uri="direct:two"/>
</route>

<route>
        <from uri="direct:two"/>
        <throwException ref="blahException"/>
</route>

Is this actually possible? The help pages at https://camel.apache.org/exception-clause.html don't cover this scenario. I don't really want to declare a global one either as I am going to have multiple routes dealing with BlahException slightly differently.

I am using 2.13.0. Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: exception handling across routes

Minh Tran
Solution was to use the no error handler on the inner route.

http://stackoverflow.com/questions/7407105/camel-exception-handling-in-sub-routes

On 11/04/2014, at 12:53 PM, Minh Tran <[hidden email]> wrote:

> Hi
>
> I'm attempting to catch an exception thrown from another route as follows.
>
> <route>
> <from uri="direct:one"/>
> <onException>
> <exception>BlahException</exception>
> <handled>
> <constant>true</constant>
> </handled>
> <to message="handled blah"/>
> </onException>
> <to uri="direct:two"/>
> </route>
>
> <route>
> <from uri="direct:two"/>
> <throwException ref="blahException"/>
> </route>
>
> Is this actually possible? The help pages at https://camel.apache.org/exception-clause.html don't cover this scenario. I don't really want to declare a global one either as I am going to have multiple routes dealing with BlahException slightly differently.
>
> I am using 2.13.0. Thanks.