简体   繁体   中英

Setting variables from Mule 4 Script (Groovy)

Previously in Mule 3.xx, we would be able to set variables from within a groovy script using. message.setInvocationProperty("name", "value") .

I cannot seem find a way to do this anymore. I am aware that the mule message structure has changed, but is there a way for one to set variables/attributes from a Mule 4 script similar to the way we could in Mule 3?

Thanks in advance.

No, in Mule 4 you cannot modify vars directly.

You can set the return value of the script to go directly to a variable though using the target attribute, with it's value being the name of the variable:

<scripting:execute engine="groovy" target="myVar">

Probably best as well - to keep the script decoupled from mule specifics.

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