我有一个骡子流,可以抛出一个异常(无法连接到连接器,组件抛出异常等等)。当这种情况发生时,骡子流在异常发生的地方停止。我需要捕捉流抛出的任何异常,并发送一个eMail通知,指示发生了异常。(特别是对于运行异步的流,比如从JMS读取)。应该使用流中的哪个元素捕获任何异常并发送eMail?
我试过:
<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>但是当我启动骡子应用程序时,我得到了一个错误:
根异常堆栈跟踪: org.xml.sax.SAXParseException: cvc-complex-trace.2.4.a:找到无效的内容,以元素“捕获-异常-策略”开头。其中一个'{"http://www.mulesoft.org/schema/mule/core":abstract-message-processor,“http://www.mulesoft.org/schema/mule/core”:抽象出站端点,"http://www.mulesoft.org/schema/mule/core":response,"http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy,"http://www.mulesoft.org/schema/mule/core":abstract-message-info-mapping}‘是预期的。在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(设置调试级别日志或‘-Dmule.everose.Exception=true’)
我用的是Mule 3.2.2。你能帮忙吗?
发布于 2013-03-14 16:59:06
在Mule 3.3中,我通常使用catch-exception-strategy。
在Mule 3.2和之前的版本中,default-exception-strategy是正确的选择,但可能有些异常没有被正确捕获。在Mule 3.3中对此进行了全面修订。是时候升级了?
发布于 2016-02-10 14:19:29
试着用这个。}从.
<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>https://stackoverflow.com/questions/15415545
复制相似问题