getting inbound properties of ESB Mule message using Groovy

五迷三道 提交于 2019-12-06 15:15:13

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:

  1. Replace the groovy component with MEL, replace <scripting:component doc:name="Groovy"> with <expression-component doc:name="Expression">
  2. 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;
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!