2

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]

How do I go about adding a new variable (say variable2), or modifying the value of an existing variable?

I've tried:

<message-properties-transformer doc:name="Message Properties">
    <add-message-property key="message.payload.AddJob.variable2" value="&quot;hello&quot;"/>
</message-properties-transformer>

Which had no effect.

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'
4

1 回答 1

9

What with:

<expression-transformer
            expression="#[message.payload.AddJob.variable2='hello';message.payload]" />

?

于 2012-09-27T02:55:01.803 回答