concept stoponexception in category camel

appears as: stopOnException
Camel in Action

This is an excerpt from Manning's book Camel in Action.

Our multicast solution at Rider Auto Parts suffers from a problem: if the order failed to send to the accounting queue, it might take longer to track down the order from production and bill the customer. To solve this problem, you can take advantage of the stopOnException feature of the multicast. When enabled, this feature will stop the multicast on the first exception caught, so you can take any necessary action.

To enable this feature, use the stopOnException method as follows:

Using stopOnException

The first solution requires you to configure the stopOnException option on the Splitter as follows:

from("direct:start") .split(body(), new MyAggregationStrategy()) .stopOnException() .log("Split line ${body}") .bean(WordTranslateBean.class) .to("mock:split") .end() .log("Aggregated ${body}") .to("mock:result");

In XML, you use the stopOnException attribute on the <split> tag, as follows: