【发布时间】:2014-10-08 07:57:10
【问题描述】:
我正在使用 camel 2.14.0 和新的 rest dsl 功能。似乎例外条款不适用于rest dsl。我做错什么了吗?这是我的课程:
public MyRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
restConfiguration.component("servlet").bindingMode(RestBindingMode.json);
onException(RuntimeException.class).process(new MyProcessor()).stop();
rest("/test")
.get("/error")
.route()
.bean(MyClassRaiseException.class, "test");
}
}
public MyClassRaiseException {
public void test() {
throws new RuntimeException("TEST");
}
}
public MyProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
System.out.println("This line of code is not executed");
}
}
MyProcessor 未被调用。求帮助!!
【问题讨论】:
-
也请确认一下,确实调用了 test()。
-
test() 确实被调用了,因为我可以在控制台中看到错误堆栈跟踪。
-
这与Apache Camel onException不同。因为如果我使用java dsl而不是rest dsl我没有问题。
标签: java rest apache-camel