Mule JSON 选择过滤器中的负载空检查
Mule JSON Payload null check in Choice Filter
我是不是做错了什么?即使 json 有效负载是 [],它也会转到默认值而不是错误日志。
<choice doc:name="If Payload is Null">
<when expression="#[payload == empty]">
<mule-logger-module:logger-exception message="Null Payload" doc:name="Log Error"/>
</when>
<otherwise>
<mule-logger-module:log-default message="Payload Received" type="EXIT" doc:name="Log End"/>
</otherwise>
</choice>
首先转换为贴图数组,然后使用 MEL 表达式测试空:
<json:json-to-object-transformer
returnClass="java.util.HashMap[]" doc:name="JSON to Object" />
<choice doc:name="If Payload is Null">
<when expression="#[payload == empty]">
<mule-logger-module:logger-exception message="Null Payload" doc:name="Log Error"/>
</when>
<otherwise>
<mule-logger-module:log-default message="Payload Received" type="EXIT" doc:name="Log End"/>
</otherwise>
我是不是做错了什么?即使 json 有效负载是 [],它也会转到默认值而不是错误日志。
<choice doc:name="If Payload is Null">
<when expression="#[payload == empty]">
<mule-logger-module:logger-exception message="Null Payload" doc:name="Log Error"/>
</when>
<otherwise>
<mule-logger-module:log-default message="Payload Received" type="EXIT" doc:name="Log End"/>
</otherwise>
</choice>
首先转换为贴图数组,然后使用 MEL 表达式测试空:
<json:json-to-object-transformer
returnClass="java.util.HashMap[]" doc:name="JSON to Object" />
<choice doc:name="If Payload is Null">
<when expression="#[payload == empty]">
<mule-logger-module:logger-exception message="Null Payload" doc:name="Log Error"/>
</when>
<otherwise>
<mule-logger-module:log-default message="Payload Received" type="EXIT" doc:name="Log End"/>
</otherwise>