Apache Camel:将选择添加到路径时,路由循环丢失 [英] Apache Camel: Route loop is lost when choice is added to the path
本文介绍了Apache Camel:将选择添加到路径时,路由循环丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用条件和拆分器来实现路由.
I am trying to implement a route with conditions and splitters.
from("{{" + feed + ".downloadSource}}")
.routeId(feed)
.setProperty("workDirectory",simple("{{workDirectory}}"))
.setProperty("splitSize",simple("{{" + feed + ".splitSize}}"))
.setProperty("feedName", simple(feed))
.setProperty("tableName",simple("{{" + feed + ".tableName}}"))
.setProperty("options", simple("{{" + feed + ".options}}"))
.setProperty("dateFormat", simple("{{" + feed + ".dateFormat}}"))
.setProperty("headerFormat", simple("{{" + feed + ".headerFormat}}"))
.setProperty("authenticateURL", simple("{{" + feed + ".authenticateURL}}"))
.setProperty("username", simple("{{" + feed + ".username}}"))
.setProperty("password", simple("{{" + feed + ".password}}"))
.loop(24)
.split(beanExpression(new APProcessor(), "getSplitProcessor"))
.process(APProcessor.getDownloadProcessor())
.process(APProcessor.getNamingProcessor())
.to("{{" + feed + ".downloadDestination}}")
.choice()
.when(simple("${property.CamelSplitComplete} == true"))
.process(APProcessor.getAggregatorProcessor())
.process(new RSProcessor())
.endChoice();
当我在 APProcessor 方法 getSplitProcessor 中执行此路由时,当我检索 CamelLoopIndex 时,它每次都返回 0.如果我删除选择块,它执行得很好.我错过了这个问题.需要帮助.
When This route is executed in the APProcessor method getSplitProcessor when I retrieve the CamelLoopIndex it returns 0 everytime. If I remove the choice block it executes fine. I am missing the issue. Need help.
推荐答案
循环包括所有操作,直到第一次出现 to
.作为一种解决方法,您可以将所有可重复的操作移动到单独的 direct:
路由中.
A loop includes all operations until the first occurense of to
. As a workaround you could move all repeatable operations into a separate direct:
route.
这篇关于Apache Camel:将选择添加到路径时,路由循环丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文