1

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.

star
  • 1,493
  • 1
  • 28
  • 61

4 Answers4

3

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

star
  • 1,493
  • 1
  • 28
  • 61
2

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.

DimaSan
  • 12,264
  • 11
  • 65
  • 75
a.cayzer
  • 289
  • 4
  • 22
1

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
Julio Cejas
  • 573
  • 5
  • 16
  • Thanks a ton!! It worked!! I can able to extract flowName. Is there a way to extract messageProcessor Name. By curious, I have tried like thz #[flow.processor] and #[flow.messageProcessor] but it returns null.Any idea? – star Nov 23 '14 at 03:55
  • If you want to know where processors message is being executed, I recommend using a ComponentMessageNotificationListener. http://www.mulesoft.org/documentation/display/current/Mule+Server+Notifications – Julio Cejas Nov 23 '14 at 15:54
0

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"/>
Sanjeet Pandey
  • 546
  • 4
  • 23