我定义了一个流程。它使用CXF发布Web服务,交换模式:请求 - 响应。服务定义/抛出异常类型:CAEService_Exception。 Web服务实现几乎是虚拟的。 ws请求由流中的其他消息处理器处理。在流程中,其他组件或ESB本身可能会抛出不同的异常,例如ConnectionException,ApplicatOneException或CompnentTwoException永远是什么。 在这种情况下,重要的是只将(业务异常)CAEService_Exception抛出到客户端! 如何获取(捕获)不同的异常,以及如何处理/处理它们以便CXF模块将CAEService_Exception抛出到客户端?
感谢您的建议! 问候 Dianlong
<flow name="CAEService" doc:name="CAEService">
<http:inbound-endpoint address="${http.host.inbound}/ebiz/ws/CAEService" exchange-pattern="request-response" doc:name="HTTP">
<cxf:simple-service serviceClass="org.mule.j2a.ws.cae.CAEService"/>
</http:inbound-endpoint>
<component class="org.mule.j2a.ws.cae.CAEServiceImpl" doc:name="Java"/>
<flow-ref name="Fest_ERPs" doc:name="Sub Flow with transformers, call other services, etc."/>
<!-- exceptions -->
</flow>
答案 0 :(得分:0)
您可以使用选择 - 例外策略来捕获不同的策略。
例如
<flow name="Sample_Flow">
...
<choice-exception-strategy doc:name="Choice Exception Strategy">
<catch-exception-strategy doc:name="Catch Exception Strategy"/>
<rollback-exception-strategy doc:name="Rollback Exception Strategy"/>
</choice-exception-strategy>
</flow>
然后在那里向客户端抛出别的东西
<catch-exception-strategy name="Catch_Exception_Strategy">
-- do you stuff
</catch-exception-strategy>