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
{ | |
"countries": [ | |
{ | |
"name": "Netherlands", | |
"continent": "Europe", | |
"cities": [ | |
{ | |
"name": "Amsterdam", | |
"population": "0.821", | |
"isCapital": true |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<fg:Countries xmlns:fg="http://examples.fganora.com"> | |
<fg:Country> | |
<fg:Name>Netherlands</fg:Name> | |
<fg:Continent>Europe</fg:Continent> | |
<fg:Cities> | |
<fg:City capital="YES"> | |
<fg:Name>Amsterdam</fg:Name> | |
<fg:Population>0.821</fg:Population> | |
</fg:City> |
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="testJSONtoObject"> | |
<http:listener config-ref="HTTP_Listener_Configuration" path="/jsontoobj" allowedMethods="POST" doc:name="HTTP"/> | |
<json:json-to-object-transformer returnClass="java.util.HashMap" doc:name="JSON to Object" /> | |
<set-payload value="#[message.payload.countries[2].capital + ', ' + message.payload.continent]" doc:name="Set Payload"/> | |
</flow> |
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
%dw 1.0 | |
%output application/json | |
--- | |
payload.jobs map { | |
name : $.name, | |
url : $.url, | |
status : $.statusCode | |
} filter ((job) -> job.statusCode == "0") |
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
%dw 1.0 | |
%output application/json | |
%var statusCodeToStatusDescription = { | |
0 : "Success", | |
1 : "Warning", | |
2 : "Error" | |
} | |
--- | |
payload.jobs map { | |
name : $.name, |
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
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" | |
xmlns:spring="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd | |
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd | |
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd | |
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd | |
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd"> | |
<http:listener-config |
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
def menu = new XmlSlurper().parseText(payload) | |
def totalPrice = 0.0 | |
(menu.food).each { | |
menuItem -> | |
totalPrice += Double.parseDouble(menuItem.price.text()) | |
} | |
totalPrice |
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
<configuration doc:name="Configuration"> | |
<expression-language> | |
<global-functions> | |
def logMessage(loggerName, messageToLog) { | |
return "[" + flow.name + ":" + loggerName + "]: " + messageToLog; | |
} | |
</global-functions> | |
</expression-language> | |
</configuration> |
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
import org.mule.DefaultMuleMessage; | |
import org.mule.module.client.MuleClient; | |
request = new DefaultMuleMessage(payload, app.registry['_muleContext']); | |
MuleClient client = new MuleClient(app.registry['_muleContext']); | |
client.send("vm://myqueue", request); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" | |
xmlns:spring="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd | |
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd | |
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd | |
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd"> | |
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/> |
NewerOlder