使用Groovy获得ESB Mule消息的入站属性 [英] getting inbound properties of ESB Mule message using Groovy

查看:272
本文介绍了使用Groovy获得ESB Mule消息的入站属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 我有一个groovy转换器组件,它可以获取入站属性并将其设置在流程变量中,如下所示。 if(message.inboundProperties.'http.query.params'.Brand!= null){
flowVars ['Brand'] = message.inboundProperties.'http.query.params'.Brand
}
返回有效载荷;

但是我低于指定的错误。看来inboundProperties不在groovy的范围之内。您能否告诉我如何访问groovy中的入站属性。

注意:我不想改变有效载荷。我的目标是创建基于queryparms的flowVars。



部分错误:

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


解决方案

我看不到 getInboundProperties()方法 on DefaultMuleMessage

我猜你想要:



<$ p $如果(message.getInboundProperty('http.query.params')?. Brand){
flowVars ['Brand'] = message.getInboundProperty('http.query.params') .Brand
}


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
}

这篇关于使用Groovy获得ESB Mule消息的入站属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆