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)
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
}
You have two options to set the variable from inbound properties:
<scripting:component doc:name="Groovy">
with <expression-component doc:name="Expression">
Keep using groovy component, then modify the existing code
if(message.getInboundProperty('http.query.params').get('Brand') != null) { flowVars ['Brand'] = message.getInboundProperty('http.query.params').get('Brand'); } return payload;
Use message.getInboundProperty.
def brand = message.getInboundProperty('http.query.params').Brand
if (brand != null){
flowVars ['Brand'] = brand
}
return payload;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.