Java Camel:在从2.14版之前的资源获取数据时发生异常时,如何强制enrich()不调用aggregate()
在camel 2.14中出现了选项Java Camel:在从2.14版之前的资源获取数据时发生异常时,如何强制enrich()不调用aggregate(),java,apache-camel,integration,Java,Apache Camel,Integration,在camel 2.14中出现了选项aggregateOnException以强制调用aggregate() 但我们使用的是2.8版 就我而言,这样的代码 from("some_route").routeId("enrich") .enrich("some_resource_with_useful_info", MyAggregator()) .multicast().stopOnException()
aggregateOnException
以强制调用aggregate()
但我们使用的是2.8版
就我而言,这样的代码
from("some_route").routeId("enrich")
.enrich("some_resource_with_useful_info", MyAggregator())
.multicast().stopOnException()
.to("first_client", "second_client");
可能在“一些具有有用信息的资源”
上失败,我不希望camel在MyAggregator
中调用aggregate()
。但它确实调用了第二个异常
还配置了一个例外
onException(Exception.class).handled(true).useOriginalMessage()
.to(ERROR_LOGGING_ENDPOINT).end();
您只需在MyAggregator
中检测异常,并将其传播到oldchange,以便Camel错误处理程序可以作出反应
这是一件很长的事情
if (newExchange.getException() != null) {
oldExchange.setException(newExchange.getException());
return oldExchange;
}