我們有我們的騾子流的一個例外策略如下嘲諷例外策略
<flow name="myFlow">
.........
.........
outboubd-call
.........
<catch-exception-strategy>
<exception-strategy ref="myOwnExceptionStrategy" />
</catch-exception-strategy>
</flow>
雖然我們使用munit嘲諷對外拋出異常,它進入追趕異常策略。
我也嘲諷如下但是
whenMessageProcessor("exception-strategy").thenReturn(muleMessageWithPayload("OK"));
,而不是返回指定的騾子消息,它實際上是進入了被稱爲例外策略(我可以通過日誌清楚地看到)。
我也試過以下
Map<String,Object> map = new HashMap<String,Object>();
map.put("ref","myOwnExceptionStrategy");
whenMessageProcessor("exception-strategy").withAttributes(map).thenReturn(muleMessageWithPayload("OK"));
不幸的是,上面的方法也沒有收穫。
向我提出一個解決方案。
」此外,如果你期待着一個異常,你不能只聲明拋出正確的異常嗎?或者正確的錯誤響應返回等?「 我認爲目標是確保在拋出異常時調用正確的異常策略。 – SteveT