而在WSO2中扮演Mediator

时间:2016-03-04 17:32:59

标签: wso2 esb

您好我正在尝试在ESB中创建一个While,但是没有一个While Mediator,当它找到正确的值时它试图用环回来打破一个foreach并且它有效但是这个动作将我带到了outSequence ,不允许我继续在inSequence中工作,有什么建议吗?

提前致谢。

1 个答案:

答案 0 :(得分:1)

你可以像这样解决问题;

<!-- Assume that we have to iterate through 'items' array, "items" :[....] and 'noOfItems' property will hold the number of iterations. -->
<property name="noOfItems" expression="count(//items)" scope="operation" />
<property name="itemIndex" expression="0" scope="operation" />
<iterate continueParent="false" id="stories" expression="//items" sequential="false" preservePayload="false">
    <target>
        <sequence>
            <!-- Your iteration logic -->

        </sequence>
        </target>
</iterate>

<!-- Move to outSequence if use "<loopback />" or include any post iteration logic when all the iterations are done. -->
<filter xpath="get-property('operation', 'itemIndex') = get-property('operation', 'noOfItems')">
    <then>

        <!-- to move outSequence -->
        <loopback />
    </then>
</filter>