Mule-esb:使用Choice Router根据状态代码处理球衣响应吗? [英] Mule-esb: Process Jersey Response based on Status code using Choice Router?
本文介绍了Mule-esb:使用Choice Router根据状态代码处理球衣响应吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何处理基于201
或503
的Jersey Rest
服务响应?我可以混合使用groovy
和其他评估者吗?在我的示例中,部分使用了消息属性和其他常规用法
How can I process a Jersey Rest
Service Response based on 201
or 503
? Can I mix groovy
and other evaluators? In my example, part is using message properties and other 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>
推荐答案
您可以使用 MEL 语法.
choice
也需要一个otherwise
块,在这种情况下决定要执行的操作.
choice
needs an otherwise
block also, decide what you want to do in that case.
<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>
这篇关于Mule-esb:使用Choice Router根据状态代码处理球衣响应吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文