Skip to content

Instantly share code, notes, and snippets.

@felipebizz
Created June 26, 2015 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save felipebizz/5c56af6072b8c446a88d to your computer and use it in GitHub Desktop.
Save felipebizz/5c56af6072b8c446a88d to your computer and use it in GitHub Desktop.
[Mule] Set variable value inside Groovy
<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