【问题标题】:Mule-ESB: Mule filter based on HTTP StatusMule-ESB:基于 HTTP 状态的 Mule 过滤器
【发布时间】:2013-11-06 00:27:43
【问题描述】:

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

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

【问题讨论】:

  • 问题是:如果状态为201,你想做什么?

标签: mule mule-studio


【解决方案1】:

查看此帖子Mule-esb: Process Jersey Response based on Status code using Choice Router?

这是来自上述链接的 sn-p,它回答了您的问题。

<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.status 时添加额外的 ''。它应该像:#[message.inboundProperties['http.status']=='201']
【解决方案2】:

您不必为此使用过滤器,而是选择消息处理器:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-28
    • 1970-01-01
    相关资源
    最近更新 更多