如何使用选择过滤器以外的过滤器来根据 http 状态调用子流?
<flow>
<http:outbound-endpoint exhange-pattern="request-response>
if http.status!=201
<flow-ref="subflow-to-invoke">
</flow>
如何使用选择过滤器以外的过滤器来根据 http 状态调用子流?
<flow>
<http:outbound-endpoint exhange-pattern="request-response>
if http.status!=201
<flow-ref="subflow-to-invoke">
</flow>
检查这篇文章Mule-esb: Process Jersey Response based on Status code using Choice Router?
这是上面链接的片段,可以回答您的问题。
<flow>
<http:outbound-endpoint address="${host}" exchange-pattern="request-response"/>
<choice>
<when expression="#[message.inboundProperties['http.status']]==201">
<flow-ref name=="flow2">
</when>
<when expression="#[message.inboundProperties['http.status']]==503">
<flow-ref name="flow3">
</when>
<when expression="#[payload instanceof java.lang.SocketException]">
<flow-ref name="flow4">
</when>
<otherwise>
<!-- decide what you want to do here -->
</otherwise>
</choice>
您不必为此使用过滤器,而是选择消息处理器:
http://www.mulesoft.org/documentation/display/current/Choice+Flow+Control+Reference