下面是我的骆驼路线代码
.errorHandler(deadLetterChannel("jmstx:queue:ErrorHandler")
.useOriginalMessage()
.maximumRedeliveries(1));
from("jmstx:queue:ErrorHandler")
.log("Sending Exception to MyErrorProcessor")
.bean(MyErrorProcessor.class);
from("file:/E:/Target/").routeId("Route1")
.setHeader("route1Header").constant("changed")
.log(LoggingLevel.DEBUG, "Route1Logger", "Inside Route 1")
.throwException(new MyException("E_MYERROR_01"))
.to("file:/E:/Target/Done");
下边是MyErrorProcessor
代码
public void process(Exchange exchange) throws Exception {
Exception e=(Exception)exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
e.printStackTrace();
if(e instanceof MyException){
MyCustomMessage myMsg=new MyCustomMessage(exchange);
logger.error(((MyException) e).getErrorCode(),((MyException) e).getErrorDesc());
}else{
MyCustomMessage myMsg=new MyCustomMessage(exchange); logger.error(myMsg.getFromRouteId(),e.getMessage());
}
}
我的记录器没有记录我发送的错误代码E_MYERROR_01
我在errorHandler deadletterchannel中做错了什么吗?