Mule-ESB: Mule filter based on HTTP Status

流过昼夜 提交于 2020-01-03 04:26:05

问题


How do I use a filter other than a choice filter to call a subflow based on the http status?

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

回答1:


Check this post Mule-esb: Process Jersey Response based on Status code using Choice Router?

Here is snippet from the above link, that answers your question.

<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>




回答2:


You don't have to use a filter for that but a choice message processor:

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



来源:https://stackoverflow.com/questions/19758138/mule-esb-mule-filter-based-on-http-status

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!