我有一个可能会抛出异常(无法连接到连接器,组件抛出异常等)的骡流。发生这种情况时,骡流停止在发生异常的地方。我需要捕捉流抛出的异常,并发送指示异常发生的电子邮件通知。 (特别是对于像从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>
但这似乎工作,只有当流动引发异常(正常流程运作的改变)。
@大卫Dossot - 我加了下面的代码片段:
添加以下代码片段:
<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>
但启动骡子应用程序时,我得到一个埃罗:
根异常堆栈trace: org.xml.sax.SAXParseException:cvc-complex-type.2.4.a:发现无效的内容以元素“catch-exception-strategy”开头。 “{”http://www.mulesoft.org/schema/mule/core“:抽象消息处理器,”http://www.mulesoft.org/schema/mule/core“:抽象出站端点,”http://www.mulesoft.org/schema/mule/core“:响应,”http://www.mulesoft.org/schema/mule/core“:抽象异常策略,”http://www.mulesoft.org/schema/mule/core“:abstract-映射}'是预期的。 在com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java: 131) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384) + 3 more(为所有内容设置调试级别日志或'-Dmule.verbose.exceptions = true' )
我使用的是Mule 3.2.2。你能帮忙吗?
@ddossot我试着在流程中添加它,但在启动mule时出现错误。你能否确认应该在哪里添加? – 2013-03-14 17:32:44
@ddossot谢谢大卫。不幸的是我没有控制!没有其他办法了? – 2013-03-14 18:14:16
Mule 3.2太老了,我不记得确切:它可能可以配置运输本身的例外策略? – 2013-03-14 18:38:42