【发布时间】:2013-03-03 04:08:07
【问题描述】:
我有一个可能引发异常的 mule 流(无法连接到连接器、组件引发异常等)。发生这种情况时,mule 流会在发生异常的地方停止。我需要捕获流程抛出的任何异常,并发送一封电子邮件通知,指示发生了异常。 (特别是对于像从 JMS 中读取一样异步运行的流)。我应该使用流程中的哪个元素来捕获任何异常并发送电子邮件?
我试过了:
<default-exception-strategy>
<smtp:outbound-endpoint host="${email.relay.host}"
mimeType="text/html" from="${email.support.from" to="${email.support.to}"
cc="${email.support.cc}" bcc="${email.support.bcc}" subject="${email.support.subject}">
</smtp:outbound-endpoint>
</default-exception-strategy>
但这根本没有开始。 我也试过:
<exception-type-filter expectedType="java.lang.Exception"></exception-type-filter>
但这似乎只有在流程抛出异常时才有效(正常流程功能发生变化)。
@David Dossot - 我添加了以下 sn-p:
我添加了以下 sn-p :
<catch-exception-strategy>
<smtp:outbound-endpoint host="${email.relay.host}"
mimeType="text/html" from="${email.support.from" to="${email.support.to}"
cc="${email.support.cc}" bcc="${email.support.bcc}" subject="${email.support.subject}">
</smtp:outbound-endpoint>
</catch-exception-strategy>
但在启动 mule 应用程序时出现错误:
根异常堆栈跟踪: org.xml.sax.SAXParseException:cvc-complex-type.2.4.a:发现以元素“catch-exception-strategy”开头的无效内容。 '{"http://www.mulesoft.org/schema/mule/core":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-outbound-endpoint, "http://www.mulesoft.org/schema/mule/core":response, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy, "@ 之一987654325@":abstract-message-info-mapping}' 是预期的。 在 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) 在 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131) 在 com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384) + 3 个以上(设置调试级别日志记录或 '-Dmule.verbose.exceptions=true' 为所有内容)
我正在使用 Mule 3.2.2。你能帮忙吗?
【问题讨论】:
标签: exception-handling mule flow