Reputation: 1655
I am trying to extract a value from the defaultMuleMessage datatype but cannot get the syntax correct in Mule 3.7.3. Can anyone help?
The value I am trying to get to is found in the variable tab in the Mule debugger:
initialMessage (org.mule.DefaultMuleMessage)
-> properties (org.mule.MessagePropertiesContext)
--> inboundMap (org.mule.util.CopyOnWrite.CaseInsensitiveMap)
---> 7 (java.util.Collections$UnmodifiavleMap$UnmodifiableEntrySet$UnmodifiableEntry)
At 7 is the key=organization
If I type "initialMessage" into the debugger I receive this:
org.mule.DefaultMuleMessage
{
id=6980b240-b882-11e6-85f7-d26120524153
payload=java.lang.String
correlationId=<not set>
correlationGroup=-1
correlationSeq=-1
encoding=UTF-8
exceptionPayload=<not set>
Message properties:
INVOCATION scoped properties:
_ApikitResponseTransformer_apikitRouterRequest=yes
_ApikitResponseTransformer_bestMatchRepresentation=application/json
_ApikitResponseTransformer_contractMimeTypes=[MimeType{type='application/json'}]
counter=1
deterministicOrchestration=true
initialMessage=<<<MuleMessage>>>
logLevel=INFO
maskingEnabled=true
messageFormat=JSON
messageLocation=CLIENT_REQUEST
mongoOperation=insert-object-from-map
mongoQuery={messageLocation=client_request, payload={NullPayload}}
mongoSynchronous=false
nextOrchestratedFlow=products-getProducts
orchestrationFlows=[products-getProducts]
prevResponse=''
INBOUND scoped properties:
accept=*/*
accept-encoding=gzip, deflate, peerdist
accept-language=en-GB
organization=abc
connection=Keep-Alive
host=localhost:8089
http.listener.path=/api/*
http.method=GET
http.query.params=ParameterMap{[]}
http.query.string=
http.remote.address=/127.0.0.1
http.request.path=/api/products
http.request.uri=/api/products
http.scheme=http
http.uri.params=ParameterMap{[]}
http.version=HTTP/1.1
referer=http://localhost:8089/api/console/
ua-cpu=AMD64
user-agent=Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; managedpc; rv:11.0) like Gecko
x-p2p-peerdist=Version=1.0
x-requested-with=XMLHttpRequest
OUTBOUND scoped properties:
Content-Type=text/plain;charset=UTF-8
MULE_ENCODING=UTF-8
SESSION scoped properties:
country=usa
resource=products
}
I'm trying to retrieve the "organization=abc" value.
Thanks
Upvotes: 0
Views: 495
Reputation: 496
Since the initialMessage variable is in the INVOCATION Scope, try the following:
#[message.getInvocationProperty('initialMessage').getInboundProperty('organization')]
UPDATE:
#[message]
is of type MessageContext, so you cannot get Invocation properties directly (only from MuleMessage). The expression above will not work.
UPDATE2:
Try the following #[flowVars.initialMessage.getInboundProperty('organization')]
Upvotes: 1
Reputation: 6657
From what I could get from the question and the comments for the previous answer.
You are looking to get a inbound property from a MuleMessage which itself is available as a property in the message of your flow.
Try the following solution.
#[message.inboundProperties.'initialMessage'.getInboundProperty('organization')]
Hope this helps.
Upvotes: 0
Reputation: 1
If you want to get inbound property (e.g. called organization
) from mule message using MEL, you just have to:
#[message.inboundProperties.'organization']
Upvotes: 0