我是WSO2 Enterprise Integrator的新手。
我很难使用集结的调解器来合并这两个消息。
我已将第一条消息放在属性中,以便可以访问各个值(还有其他方法吗?)
所需的输出为json格式。 (我尝试过for each
,但它仅循环出现在消息2循环消息中。)
输入消息1:
{
"customerId": "ABC123",
"channelNo": "1",
"codename": "code123"
}
输入消息2:
{
"lnsAcctInfo": [
{
"acctno": "101991100000012",
"custid": "2018111400000002",
"acctype": null,
"ccy": null,
"name": null,
"prdcode": "300"
},
{
"acctno": "101991100000022",
"custid": "2018111400000052",
"acctype": 1,
"ccy": 1,
"name": 1,
"prdcode": "300"
}
]
}
需要的输出:
{
"customerId": "ABC123",
"codename": "code123",
"lnsAcctInfo": [
{
"acctno": "101991100000012",
"custid": "2018111400000002",
"acctype": null
},
{
"acctno": "101991100000022",
"custid": "2018111400000052",
"acctype": 1
}
]
}
这是突触代码:
<resource methods="POST" uri-template="/foreach">
<inSequence>
<log>
<property expression="json-eval($)" name="RecievedPostMessage" />
</log>
<property name="customid" scope="default" type="STRING" value="sampleuserid" />
<payloadFactory description="payload-xml" media-type="xml">
<format>
<lnsAcctInfo xmlns="">$1</lnsAcctInfo>
</format>
<args>
<arg evaluator="json" expression="$.lnsAcctInfo[*]" />
</args>
</payloadFactory>
<log>
<property expression="." name="payload1" />
</log>
<iterate expression="//lnsAcctInfo/jsonElement" id="1">
<target>
<sequence>
<log>
<property expression="." name="Iterate" />
</log>
<aggregate>
<completeCondition>
<messageCount max="-1" min="-1" />
</completeCondition>
<onComplete expression="//jsonElement">
<log>
<property expression="." name="aggre" />
</log>
</onComplete>
</aggregate>
</sequence>
</target>
</iterate>
<log>
<property expression="." name="overall" />
</log>
<respond />
</inSequence>
<outSequence>
<send />
</outSequence>
<faultSequence />
</resource>