我有一个有"to"条款的路线.如果发生一些异常,我已经使用try catch块将交换重定向到路由.我遇到的例外情况与客户端允许的最大并行连接数无关.似乎,当异常得到解决时,交换的每次重试都会在离开的地方进一步处理.我怎样才能结束有例外的路线.
以下是我的代码.
from("direct:hourlyFeedParts") .routeId("appnexus hourly downloader") .doTry() .process(AppNexusProcessor.getDownloadProcessor()) .process(AppNexusProcessor.getNamingProcessor()) .id("Appnexus Feed Downloader") .log("Downloading file ${file:name}") .to("{{appnexus.partsDestination}}") .log("Downloaded file ${file:name} to local") .doCatch(Exception.class) .to("direct:hourlyFeedParts") .end() .bean(AppNexusProcessor.class, "updateIdempotentList") .choice() .when(simple("${property.CamelSplitComplete} == true")) .split(beanExpression(AppNexusProcessor.class, "getAggregatorProcessor")) .to("direct:S3PreProcessor") .endChoice() .end();
我以为可能正在使用endParent()之后
.doCatch(Exception.class) .to("direct:hourlyFeedParts") .endParent()
这是正确的方法吗?我无法理解文档中endParent()的确切用法.
只需stop()
在doCatch()
块的末尾添加:
.doCatch(Exception.class) .to("direct:hourlyFeedParts") .stop() .end()