【问题标题】:Choice Exception Strategy doesn't work in Mule选择异常策略在 Mule 中不起作用
【发布时间】:2014-10-02 03:03:23
【问题描述】:

以下是流程的异常策略部分

<choice-exception-strategy doc:name="Choice Exception Strategy">
            <catch-exception-strategy when="exception.causedBy(java.sql.BatchUpdateException)" doc:name="SQL deadlock error">
                <logger message="SQL EXCEPTION - RETRYING BATCH PROCESS"
                    level="ERROR"  doc:name="Payload Logger" category="asi_user"/>
                <set-variable variableName="Exception" value="User" doc:name="Exception Type"/>
                <flow-ref name="Reload_Batch" doc:name="Retry Batch Results"/>
            </catch-exception-strategy>
            <catch-exception-strategy when="exception.causedBy(com.microsoft.sqlserver.jdbc.SQLServerException)" doc:name="SQL error">
                <logger message="SQL EXCEPTION - RETRYING BATCH PROCESS"
                    level="ERROR" category="asi_user" doc:name="Payload Logger" />
                <set-variable variableName="Exception" value="User" doc:name="Exception Type"/>
                <flow-ref name="Reload_Batch" doc:name="Retry Batch Results"/>
            </catch-exception-strategy>
            <catch-exception-strategy  doc:name="Unexpected errors">
                <logger message="UNEXPECTED EXCEPTION - SEND EMAIL NOTIFICATION"
                    level="ERROR" category="asi_user" doc:name="Payload Logger" />
                <set-payload value="#[exception.cause.message]" doc:name="Set Payload"/>
                <flow-ref name="Send_Error_Notification" doc:name="Send Email Notification"/>
            </catch-exception-strategy>
        </choice-exception-strategy>

即使从流程中抛出 java.sql.BatchUpdateException,控制也会进入最终的异常策略“Unexpected Errors”,不会进入 SQL 死锁错误

我是否缺少任何使它起作用的东西。

请帮我解决这个问题。我使用的是 Mule server 3.4.0 EE

提前谢谢你

【问题讨论】:

  • 尝试在“意外错误”部分打印 exception.getClass() 并检查异常是否为“java.sql.BatchUpdateException”。
  • 解决方案对您有用吗?

标签: exception-handling mule mule-studio mule-component


【解决方案1】:

这是你在when中表达的问题

试试下面的方法。

<catch-exception-strategy when="#[exception.causedBy(java.sql.BatchUpdateException)]" doc:name="SQL deadlock error">

希望这会有所帮助。

【讨论】:

  • 请为答案投票。这有助于在再次搜索此问题时改进搜索结果。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多