问题
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:
Which Iterate ID should be given to Aggregate mediator to get payload from both Iterate mediators? Will the outer Aggregate's ID work?
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