Simbu Simbu - 3 months ago 35
Groovy Question

getting inbound properties of ESB Mule message using Groovy

I have groovy transformer component which is to get the inbound properties and set it in the flow vars as like below.

if(message.inboundProperties.'http.query.params'.Brand != null){
flowVars ['Brand'] = message.inboundProperties.'http.query.params'.Brand
}
return payload;


But I am getting below specified error. It seems inboundProperties are not in the scope of groovy. Can you please tell me how to access inbound properties in groovy.

Note : I dont want to alter the payload. My aim is to create the flowVars based on queryparms.

Part of Error :

No such property: inboundProperties for class: org.mule.DefaultMuleMessage (groovy.lang.MissingPropertyException)
org.codehaus.groovy.runtime.ScriptBytecodeAdapter:51 (null)

Answer

I can't see a getInboundProperties() method on DefaultMuleMessage

I'm guessing you want:

if(message.getInboundProperty('http.query.params')?.Brand){
    flowVars ['Brand'] = message.getInboundProperty('http.query.params').Brand
}