mule flow with groovy script

1
2
3
4
5
6
7
8
9
10
11
<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>
1
2
3
4

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