How to Extract the Flow Name and MessageProcessor Name using MEL - MULE ESB

4.5k Views Asked by At

I'm not sure, how can we extract the flow-name and message-processor Name through MEL. For example I have multiple message processor. For logging, i need to extract the flow Name and Message-processor, so that I can find out transaction has crossed this particular flow and its message processor. Is there any simple way to find out. Please guide me. Please find the screenshot below. Here i need to Extract - set payload and its flowName (flow1)

enter image description here

Thanks in advance.

4

There are 4 best solutions below

2
On BEST ANSWER

You can extract the flow-name with MEL : #[flow.name]

<flow name="name" doc:name="name">
    <http:inbound-endpoint address="http://localhost:8090/resources" doc:name="HTTP" />
    <logger message="name of flow: #[flow.name]" level="INFO" doc:name="Logger"/>
    <set-payload value="name" doc:name="Set Payload"/>
</flow>

or

flowConstruct.getName() in a Message Processor
0
On

Two ways to acthive this (from current flow name)

First one is -

<logger message="Current flowName: #[flow.name]" level="INFO" doc:name="Logger"/>

and the second one is -

<logger message="Current flowName: #[context:serviceName]" level="INFO" doc:name="Logger"/>
0
On

For mule 3.8+ version onwards #[flow.name] don't work.

Use #[mule:context.serviceName] expression in logger or component to extract the name of the flow

0
On

I know this post is old but I have been trying to find a way to do this in MEL for error handling emails.

For the flow name you can use #[exception.event.flowConstruct.name] for the failing message processor you can use #[exception.failingMessageProcessor].

Both of these work in MEL without the need to use an flowVar.

Please note however, that the failing processor does not always come back with a value but comes back with null, I'm not sure why.