Mule ESB - Catch Exception Strategy block and Payl

2019-08-08 12:03发布

Mule documentation states that catch-exception-strategy is similar to java catch block. But unfortunately, the payload is consumed (message is consumed); from the catch block the payload is lost (unlike a java method where you can access the method input parameters from a catch/finally block).

The problem with this design is that at any instance, (from the catch strategy flow) it is impossible to know the error and last known enriched payload which was used (which caused the error?). This complicates auditing of data which caused the error.

Suppose if there is a flow with 10 message processors, it becomes tedious to identify the message processor which threw error.

I can see 2 workarounds regarding the payload:
1) After the inbound endpoint, push the payload to a flow variable before every message processor (again another disadvantage is what happens to the Inbound properties and attachments?)
2) Use Rollback exception strategy with zero attempts (the transaction will be rolled back), and original input message may be available. (drawback: it is difficult to introspect on why the error happend and on which message processor - example: I may have 5 or 6 DB processors)

The reason why this becomes important is supporting an ESB application in production becomes easier.

For example, from the catch-block if we are able to pipe the payload and exception details (linked to a single UID), then you can run a log monitor tool, push it to a real time dashboard for monitoring purpose/raise Alerts. The same approach can be uniformly applied to all the applications/flows and java components, etc.

MMC is weak in this area - for example, if you want to supress Alerts from a batch job after 5 occurrences, MMC cannot do it.

My questions are: 1) Is there any reason on why the payload is made unavailable? Possible workaround is to push (last known data) to another variable as part of message called originalPayload or originalInboundProperties? 2) Any other straight forward way of piping the exception and payload to an appender (instead of workarounds)?

Ananth Krishnan (WHISHWORKS.com)

0条回答
登录 后发表回答