本文介绍了如何修改Mule有效负载变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Mule 3.3,我有一个有效负载(它以JSON开头,并使用java.util.HashMap将其转换为对象).我可以使用以下方法通过JDBC查询访问变量:
Using Mule 3.3, I've got a Payload (which starts out as a JSON and I'm converting it to an Object using java.util.HashMap). I can access the variables just fine from a JDBC query using:
#[message.payload.AddJob.variable1]
我该如何添加新变量(例如variable2)或修改现有变量的值?
How do I go about adding a new variable (say variable2), or modifying the value of an existing variable?
我尝试过:
<message-properties-transformer doc:name="Message Properties">
<add-message-property key="message.payload.AddJob.variable2" value=""hello""/>
</message-properties-transformer>
没有效果.
我还尝试了以下建议的常规脚本(如下):,但是它会用"hello"(而不仅仅是variable2)覆盖整个有效负载.
I also tried a groovy Script (below) as suggested here: How to add additional data to a mule payload?, but it overwrites the entire payload with "hello", not just variable2.
payload['AddJob.variable2'] = 'hello'
推荐答案
功能:
<expression-transformer
expression="#[message.payload.AddJob.variable2='hello';message.payload]" />
?
这篇关于如何修改Mule有效负载变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!