-
-
Save jrichardsz/84fc493c719bd43d036f676fbfa8b76a to your computer and use it in GitHub Desktop.
[Mule] Set variable value inside Groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<flow name="get:/setVariable:api-config"> | |
<set-variable variableName="username" value="" doc:name="username"/> | |
<scripting:component doc:name="Groovy"> | |
<scripting:script engine="Groovy"> | |
<![CDATA[ | |
String value = 'felipe' | |
message.setInvocationProperty('username', value) | |
]]></scripting:script> | |
</scripting:component> | |
</flow> | |
//More options of set Value inside Groovy | |
message.setInvocationProperty('myFlowVariable', 'value') // sets a flow variable, like <set-variable/> | |
message.setOutboundProperty('myProperty', 'value') // sets an outbound message property, like <set-property/> | |
message.setProperty('myInboundProperty', 'value', PropertyScope.INBOUND) // sets an inbound property |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment