Mule-ESB:基于HTTP状态的Mule过滤器

时间:2013-11-03 21:06:48

标签: mule mule-studio

如何使用选择过滤器以外的过滤器根据http状态调用子流?

<flow>  
<http:outbound-endpoint exhange-pattern="request-response>
if http.status!=201  
<flow-ref="subflow-to-invoke">  
</flow>

2 个答案:

答案 0 :(得分:3)

查看此帖子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>

答案 1 :(得分:1)

除了选择消息处理器之外,您不必使用过滤器:

http://www.mulesoft.org/documentation/display/current/Choice+Flow+Control+Reference