0

如何处理Jersey Rest基于201或的服务响应503?我可以混合groovy和其他评估者吗?在我的示例中,部分使用消息属性和其他常规

<flow> 
    <http:outbound-endpoint address="${host}" exchange-pattern="request-response"/>
    <when expression="message:INBOUND:http.status==201">  
    <flow-ref name=="flow2">  
    <when expression="message:INBOUND:http.status==503">  
    <flow-ref name="flow3">
    <when expression="payload instanceof java.lang.SocketException" evaluator="groovy">
    <flow-ref name="flow4">  
</flow>  
4

1 回答 1

1

您可以使用MEL语法完成所有这些操作。

choice也需要一个otherwise块,决定在这种情况下你想做什么。

<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="#[exception instanceof java.net.SocketException]">
             <flow-ref name="flow4">  
         </when>
         <otherwise>
         <!-- decide what you want to do here -->
         </otherwise> 
     </choice>
</flow> 
于 2013-11-05T13:43:48.523 回答