Apache Camel:当选择添加到路径时,路径循环将丢失

时间:2013-10-04 12:58:52

标签: apache-camel

我正在尝试实施具有条件和分割器的路线。

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

当我检索CamelLoopIndex时,在APProcessor方法getSplitProcessor中执行此路由时,它每次都返回0。如果我删除选择块,它执行正常。我错过了这个问题。需要帮助。

1 个答案:

答案 0 :(得分:1)

循环包括to的第一次出现之前的所有操作。作为一种解决方法,您可以将所有可重复的操作移动到单独的direct:路径中。