WSO2 EI/ESB: Aggregate mediator for nested Iterate

心不动则不痛 提交于 2020-06-17 13:26:29

问题


I am implementing Iterate mediator inside Iterate mediator. After that, I have an Aggregate mediator in out-sequence.

<inSequence>

    <iterate attachPath="json-eval($.Entity.names)" expression="json-eval($.Entity.names)" id="iterate-over-names" preservePayload="true">

        <target>
            <payloadFactory media-type="json">
                <format>[{"value" : 1},{"value" : 2},{"value" : 3},{"value" : 4},{"value" : 5},{"value" : 6},{"value" : 7},{"value" : 8},{"value" : 9}]</format>
                <args/>
            </payloadFactory>

            <iterate expression="json-eval($)" id="iterate-over-nameAddress">
                <call>
                    <endpoint>
                        <http method="get" uri-template="https://backend.com/{uri.var.value}"></http>
                    </endpoint>
                </call>
            </iterate>

        </target>
    </iterate>
</inSequence>


<outSequence>

    <aggregate id="iterate-over-names">
        <completeCondition>
            <messageCount max="-1" min="-1"/>
        </completeCondition>
        <onComplete expression="json-eval($.root)">
            <respond/>
        </onComplete>
    </aggregate>
</outSequence>

As I have two iterate mediators, they have different ids.

Questions:

  1. Which Iterate ID should be given to Aggregate mediator to get payload from both Iterate mediators? Will the outer Aggregate's ID work?

  2. What should be the Aggregate expression to get response in below format?

{
    "names": {
        "address": [
            {
                "city": ""
            },
            {
                "state": ""
            }
        ]
    }
}

来源:https://stackoverflow.com/questions/61889990/wso2-ei-esb-aggregate-mediator-for-nested-iterate

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