How to add a global exception handler / logger in Mule

We want to add a few lines of XML configuration to the mule with an exception handler that registers with SLF4J instead of where they are written right now (stdout). How do we add this?

We do not want to add this handler to each thread (50+ threads, plus, when people add threads, they may forget to add our exception handler).

+4
source share
1 answer

This is an example of "sharing a common exception handler between threads" (in this case, the catch-exception 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> 
+2
source

Source: https://habr.com/ru/post/1396654/


All Articles