我正在解决以下故障安全方案。
但是在恢复流程中,我无法获得由于subflow1或subflow2失败而发生的异常或exceptionPayload。
有没有什么办法可以让First-sucessful路由处理器中不成功的消息处理器抛出异常。
我查看了Mule FirstSuccessful
类代码。从它的循环中,我可以看到异常被捕获但未保存。
我有没有办法扩展并拥有自己的第一次成功,这也可以为我提供例外?
<flow name="main_flow" >
....
....
<first-successful>
<flow-ref name="subflow_1" />
<flow-ref name="recoveryFlow1" />
</first-successful>
....
....
<first-successful>
<flow-ref name="subflow_2" />
<flow-ref name="recoveryFlow2" />
</first-successful>
....
....
</flow>
<sub-flow name="subflow_1">
....
....
<out-bound call to web-service />
....
....
</sub-flow>
<sub-flow name="subflow_2">
....
....
<out-bound call to web-service />
....
....
</sub-flow>
<sub-flow name="revoceryFlow1" >
<process communication based on the exception thrown by previous unsuccessful sub-flow 1>
<some more processing so that the remaining main flow is not impacted because of the failue of the subflow 1 >
</sub-flow>
<sub-flow name="revoceryFlow2" >
<process communication based on the exception thrown by previous unsuccessful sub-flow 2>
<some more processing so that the remaining main flow is not impacted because of the failue of the subflow 2 >
</sub-flow>
请告知我的方向是否错误。有没有比我更好的方法?
答案 0 :(得分:0)
我得到了解决方案。 骡子没有直接的解决方案。 我已经覆盖了FirstSuccessful行为,并添加了具有异常详细信息的属性。然后在第一个成功的。
中的下一个消息处理器中访问这些属性catch (Exception ex)
{
event.getMessage().setProperty("prevError", ex.getMessage() , PropertyScope.INVOCATION);
event.getMessage().setProperty("prevErrorClass", ex.getClass() , PropertyScope.INVOCATION);
failed = true;
}