如何在Mule中一次添加全局异常处理程序/记录器 [英] How to add a global exception handler/logger once in Mule

查看:56
本文介绍了如何在Mule中一次添加全局异常处理程序/记录器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们要向Mule添加几行XML配置,并带有一个异常处理程序,该异常处理程序记录到SLF4J,而不是它们现在记录的位置(stdout).我们如何添加它?

We want to add a few lines of XML config to mule with an exception handler that logs to SLF4J instead of where they log right now (stdout). How do we add this?

我们不想在每个流程中都添加此处理程序(50多个流程,而且随着人们添加流程,他们可能会忘记添加我们的异常处理程序).

We do NOT want to have to add this handler to every single flow (50+ flows, plus as people add flows, they may forget to add our exception handler).

推荐答案

这是如何在流之间共享公共异常处理程序"的示例(在本例中为catch-exception-strategy):

This is an example of "how to share a common exception handler across flows" (in this case a catch-exception-strategy):

<catch-exception-strategy name="myGlobalCatchStrategy">
    <set-payload value="Hey something happened! : #[exception.getSummaryMessage()]" />
</catch-exception-strategy>

<configuration defaultExceptionStrategy-ref="myGlobalCatchStrategy" />

<flow name="global-catch-example">

    <inbound-endpoint address="vm://entry-point.in" exchange-pattern="request-response" />

    <test:component throwException="true" />

</flow>

这篇关于如何在Mule中一次添加全局异常处理程序/记录器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆