Mulitcast and stopOnexception

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

Mulitcast and stopOnexception

crmanoj
Hi,

I have a scenario using Multicast and I want to stop the execution if any one of the routes in multicast fails, So I used stoponException along with multicast. Though I have appropriate error handlers written I end up receiving 'org.apache.camel.CamelExchangeException: Parallel processing failed for number 0' when there is exception at one of the sub route.

Here is my route:

onException(CustomException.class).handled(true).beanRef("myErrorHandler");

from("mycxfconsumer").multicast(MyAggregationStrategy()).stopOnException().parallelprocessing().to("direct:firstroute","direct:secondroute");

from("direct:firstroute").beanRef("firstprocessor");
from("direct:secondroute").beanRef("secondprocessor");

An exception(CustomException) is thrown in the firstprocessor and caught at onException(), but at the end I receive this Parallel processing exception. I want to throw my custom exception instead of this parallelprocessing exception. I am confused here, Can someone provide your suggestions on this?

I use Camel 2.9 in fuse-esb-full-7.0.0.fuse-061.
Jdk: 1.6

Thanks in Adance!
Reply | Threaded
Open this post in threaded view
|

Re: Mulitcast and stopOnexception

Nibs
Hi ,

I am bit new with camel but i was  stuck in multicast exception handling
you can follow this link
http://camel.apache.org/exception-clause.html

and I will suggest you refer your customexception class to your route where you are doing multicast
 I mean to say

<route>
<onexception>
call your customException
<onException>

<multicast>
<to uri=""/>
<to uri=""/>
</multicast>
</route>

Don't  know how much this will help you
best of luck !!
Reply | Threaded
Open this post in threaded view
|

Re: Mulitcast and stopOnexception

crmanoj
Thank you! I do use the exception handling in my route but the problem is when I use stoponexception, On an exception the execution stops and throws 'parallel processing exception' instead of custom exception. May be that's the behaviour. Any thoughts on this?