Just took a look into this and found that setting the Exception on the Exchange doesn't really break you out of the routing slip as you want. I'm gonna fix that up on the trunk. But, throwing an Exception from a recipient does stop the routing slip. See this test case for an example http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java
On Tue, Dec 1, 2009 at 1:34 PM, murugess <[email protected]> wrote: > > We are using camel binding component, with camel version 1.6.1.0, on > servicemix for our project. We are leveraging dynamic routing slip in camel > to process our request and are facing issues related to exception handling. > We have already defined global errorHandler which handles any exception > that > occurs in any of the route. Now, whenever an exception occurs in any of the > endpoints within routing slip, exception handler is called as expected but > then once the exceptionHandler route is finished, control comes back to the > routingslip and rest of the endpoints get executed. No matter what we set > on > exception route ( such as handled=false), all the endpoints in routing slip > eventually gets called. Here is the code snippet from RoutingSlip : > > > for (String nextRecipient : recipients) { > Endpoint<Exchange> endpoint = resolveEndpoint(exchange, > nextRecipient); > Producer<Exchange> producer = > producerCache.getProducer(endpoint); > Exchange ex = current.newInstance(); > > updateRoutingSlip(current); > copyOutToIn(ex, current); > > producer.process(ex); > > current = ex; > } > > > > We don't see any provision to break from the above loop. Right now, the > work around we have adopted is to set EXCEPTION_HANDLED_PROPERTY on the > exchange so that the pipeline class does not delegate the request to the > actual endpoint. But there is still an overhead of pipeline being called > for > all the endpoints configured within the routing slip. > > Any suggestions are welcome. > -- > View this message in context: > http://old.nabble.com/How-to-break-from-routing-slip-in-camel-on-exception--tp26594251p26594251.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Cheers, Jon Camel in Action: http://manning.com/ibsen Blog: http://janstey.blogspot.com
