Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
- xmlns:twitter="http://www.mulesoft.org/schema/mule/twitter" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:json="http://www.mulesoft.org/schema/mule/json"
- xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz" 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.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
- http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
- 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/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
- http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.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/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
- http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
- http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
- http://www.mulesoft.org/schema/mule/twitter http://www.mulesoft.org/schema/mule/twitter/current/mule-twitter.xsd">
- <db:mysql-config name="MySQL_Configuration" url="jdbc:mysql://localhost:3306/mysqla2?user=root&password=hugo1995" doc:name="MySQL Configuration"/>
- <twitter:config name="Twitter__Configuration" accessKey="810196779895586816-TB1dUGgEBk1AapJR48qmOTm4CK7uVsx" accessSecret="M1NbbR1yxxhZLeKFn9p2tC9gHTfepSqCLDQ4yFGdW9iYk" consumerKey="i802werZQpXycOLedpek6u1g7" consumerSecret="kxIk7U5hJl0HkwJ1ZgfpID2RO02l09zpvHD3I3pgRGJF9sXQwr" doc:name="Twitter: Configuration"/>
- <http:listener-config name="HTTP_Listener_Configuration"
- host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration" />
- <sub-flow name="dbtestFlowJSON">
- <db:select config-ref="MySQL_Configuration" doc:name="Database">
- <db:parameterized-query><![CDATA[select student.name,student.inst_email,student.id, course_student.course_id from course_student , student where course_student.student_id = student.id;]]></db:parameterized-query>
- </db:select>
- <json:object-to-json-transformer doc:name="Object to JSON"/>
- <file:outbound-endpoint path="C:\Users\gonca\AnypointStudio\workspace\dbtest" outputPattern="students.json" responseTimeout="10000" doc:name="File"/>
- <json:json-to-object-transformer returnClass="java.util.List" doc:name="JSON to Object"/>
- <set-variable variableName="variable" value="#[message.payload]" doc:name="Variable"/>
- <logger message="after variable:- #[variable.get(1).get('name')] " level="INFO" doc:name="Logger"/>
- <foreach collection="#[flowVars.variable]" doc:name="For Each">
- <logger message="LastName #[payload]" level="INFO" doc:name="Logger"/>
- </foreach>
- </sub-flow>
- <flow name="dbtestFlow">
- <quartz:inbound-endpoint jobName="Wait3" repeatInterval="5000" responseTimeout="10000" doc:name="Quartz3">
- <quartz:event-generator-job/>
- </quartz:inbound-endpoint>
- <db:select config-ref="MySQL_Configuration" doc:name="Database">
- <db:parameterized-query><![CDATA[select content, course_id from material;]]></db:parameterized-query>
- </db:select>
- <mulexml:object-to-xml-transformer doc:name="Object to XML"/>
- <file:outbound-endpoint path="C:\Users\gonca\Desktop" outputPattern="new.xml" responseTimeout="10000" doc:name="File"/>
- <scripting:transformer doc:name="Looking for differences" encoding="ISO-8859-2">
- <scripting:script engine="Groovy">
- <scripting:text><![CDATA[import dbtest.Helpers
- import dbtest.Message
- import dbtest.MessageToParse
- Helpers.worker();
- ]]></scripting:text>
- </scripting:script>
- </scripting:transformer>
- <logger message="#[payload]" level="INFO" doc:name="Logger"/>
- <choice doc:name="Choice">
- <when expression="#[payload.size() > 0]">
- <logger message="With changes" level="INFO" doc:name="Logger"/>
- <foreach doc:name="For Each">
- <set-variable variableName="changes" value="#[payload.getAddedMaterials()]" doc:name="Added Material"/>
- <set-variable variableName="removed" value="#[payload.getRemovedMaterials()] " doc:name="Removed Material"/>
- <set-variable variableName="course_id" value=" #[payload.getCourse_id()] " doc:name="Course"/>
- <flow-ref name="dbtestFlowJSON" doc:name="dbtestFlowJSON"/>
- <logger message="Ok Students found: #[flowVars.students] ----- Removed material: #[flowVars.removed]" level="INFO" doc:name="Logger"/>
- </foreach>
- </when>
- <otherwise>
- <logger message="Without changes" level="INFO" doc:name="Logger"/>
- <foreach doc:name="For Each">
- <logger message="#[payload.getRemovedMaterials()] #[payload.getCourse_id()] " level="INFO" doc:name="Logger"/>
- </foreach>
- </otherwise>
- </choice>
- </flow>
- </mule>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement