onException(Exception.class).process(new MyFunctionFailureHandler()).stop();
public class MyFunctionFailureHandler implements Processor { @Override public void process(Exchange exchange) throws Exception { // TODO Auto-generated method stub // the caused by exception is stored in a property on the exchange Throwable caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class); // here you can do what you want, but Camel regard this exception as handled, and // this processor as a failurehandler, so it wont do redeliveries. So this is the // end of this route. But if we want to route it somewhere we can just get a // producer template and send it. // send it to our mock endpoint exchange.getContext().createProducerTemplate().send("mock:myerror", exchange); } }