0

我需要遍历路线中的项目列表。在该路线内,我再次必须遍历项目列表。我正在使用它,并使用该属性loop了解当前迭代。CamelLoopIndex

这里的问题是,假设外循环有 50 个项目要迭代,而内循环有 3 个项目要迭代。发生的情况是,在外部循环的第一次迭代之后,它直接跳到第四次迭代,因为内部循环将 设置CamelLoopIndex为 2。

我为此做了一个解决方法:

<outerLoop>
    <!-- do some stuff -->

    <!-- set the CamelLoopIndex value in a custom exchange property -->
    <innerLoop>
        <!-- do some other stuff -->
    </innerloop>
    <!-- reset the CamelLoopIndex value with the one in our custom exchange property -->

</outerloop>

有没有更好的方法来做到这一点?

4

0 回答 0