Wso2 如何对JSON消息的多个参数使用筛选器
我正在使用ESB-4.9.0版本 ESB中介流必须基于两种过滤逻辑继续。JSON消息在中介流中转换。目前,我正在使用两个过滤器中介来实现这一点是否有可能使用单个筛选器中介来实现相同的场景? 输入JSON消息Wso2 如何对JSON消息的多个参数使用筛选器,wso2,wso2esb,Wso2,Wso2esb,我正在使用ESB-4.9.0版本 ESB中介流必须基于两种过滤逻辑继续。JSON消息在中介流中转换。目前,我正在使用两个过滤器中介来实现这一点是否有可能使用单个筛选器中介来实现相同的场景? 输入JSON消息 { "filterId": "CorrectId", "approvalStatus": "approved", "lifeCycleStatus": "BRANCH_READY", "channelData": [ { "status": "pendin
{
"filterId": "CorrectId",
"approvalStatus": "approved",
"lifeCycleStatus": "BRANCH_READY",
"channelData": [
{
"status": "pending",
"indexId": "correctIndexId",
"description": "Test Description"
}
]
}
使用的ESB突触部分
<filter description="" regex="CorrectId" source="json-eval($.filterId)">
<then>
<filter description="" regex="correctIndexId" source="json-eval($.indexId)">
<then>
<!-- continue the mediation flow-1-->
</then>
<else>
<!-- continue the mediation flow-2-->
</else>
</filter>
</then>
<else>
<drop/>
</else>
</filter>
是的,这可以通过过滤器中介和xpath
concat
函数实现:
<resource methods="POST" uri-template="/onefilter">
<inSequence>
<property name="filterId" expression="json-eval($.filterId)"/>
<property name="correctIndexId" expression="json-eval($.channelData[0].indexId)"/>
<property name="combinedID" expression="fn:concat($ctx:filterId, $ctx:correctIndexId)"/>
<filter source="$ctx:combinedID" regex="CorrectIdcorrectIndexId">
<then>
<log level="custom">
<property name="message" value="continue 1"/>
</log>
<drop/>
</then>
<else>
<log level="custom">
<property name="message" value="continue 2"/>
</log>
<drop/>
</else>
</filter>
</inSequence>
顺便说一下,您的代码片段永远不会进入continue 1
路径,因为您的JSON路径无效