j'ai ajouté un BeanErreur ,
onException(Exception.class).process(new MyFunctionFailureHandler()).stop();
Voici la définition de MyFunctionFailureHandler.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
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);
}
} |
j'ai crée une exeption de type 0/0 NumberExeption mais rien ne se passe
Partager