Stop processing in case of exceptions - 6.3

Talend ESB Mediation Developer Guide

Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Design and Development
Talend ESB

The Splitter will by default continue to process the entire Exchange even in case of one of the splitted message will throw an exception during routing. For example if you have an Exchange with 1000 rows that you split and route each sub message. During processing of these sub messages an exception is thrown at the 17th. What Camel does by default is to process the remainder 983 messages. You have the chance to remedy or handle this in the AggregationStrategy.

But sometimes you just want Camel to stop and let the exception be propagated back, and let the Camel error handler handle it. You can do this by specifying that it should stop in case of an exception occurred. This is done by the stopOnException option as shown below:

            .process(new MyProcessor())

And using XML DSL you specify it as follows:

   <from uri="direct:start"/>
   <split stopOnException="true">
      <tokenize token=","/>
      <process ref="myProcessor"/>
      <to uri="mock:split"/>