Apache Camel: Route loop is lost when choice is added to the path

空扰寡人 提交于 2019-12-12 02:53:37

问题


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();

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.


回答1:


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.



来源:https://stackoverflow.com/questions/19181813/apache-camel-route-loop-is-lost-when-choice-is-added-to-the-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!