Last active
August 29, 2015 14:23
-
-
Save felipebizz/bf0393995bdfa1d40c11 to your computer and use it in GitHub Desktop.
[Mule] Add sessionVariable inside Groovy
This file contains 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:/user/{username}:api-config"> | |
<set-session-variable variableName="username" value="#[flowVars['username']]" doc:name="Session Variable"/> | |
<set-payload value="#[payload]" doc:name="payload"/> | |
<scripting:component doc:name="Groovy"> | |
<scripting:script engine="Groovy"><![CDATA[ | |
def root = [:]; | |
root.user = sessionVars['username'] | |
def jsonContent = new groovy.json.JsonBuilder(root); | |
return jsonContent.toPrettyString(); | |
]]></scripting:script> | |
</scripting:component> | |
<logger message="LOGGER USER BY USERNAME: #[username]" level="INFO" doc:name="Logger"/> | |
</flow> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment