简体   繁体   中英

Adding flow variable to Mule payload

What am I doing wrong here? I want to set the payload of a Mule message to a map containing multiple values:

<set-payload value="#[['STATUS':'OKAY','NEXT':'Test','TEXT':flowVars['myVariable']]]"/>

The output of this is:

{STATUS=OKAY, NEXT=Test, TEXT=foo}

I was expecting:

{STATUS:OKAY, NEXT:Test, TEXT:foo}

What's wrong?

Your syntax is correct. The reason it uses "=" is just the way Mule logs the Map. The payload is still a Map. If you want ":" you can transform it to Json using <object-to-json-transformer /> but that will output it like so:

{"STATUS":"OKAY", "NEXT":"Test", "TEXT":"foo"}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM