Advertisement
Guest User

Untitled

a guest
Dec 21st, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.95 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
  4. 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"
  5. 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"
  6. xmlns:spring="http://www.springframework.org/schema/beans"
  7. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  8. xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  9. http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
  10. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
  11. http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
  12. http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
  13. http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd
  14. http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
  15. http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
  16. http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
  17. http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
  18. http://www.mulesoft.org/schema/mule/twitter http://www.mulesoft.org/schema/mule/twitter/current/mule-twitter.xsd">
  19. <db:mysql-config name="MySQL_Configuration" url="jdbc:mysql://localhost:3306/mysqla2?user=root&amp;password=hugo1995" doc:name="MySQL Configuration"/>
  20. <twitter:config name="Twitter__Configuration" accessKey="810196779895586816-TB1dUGgEBk1AapJR48qmOTm4CK7uVsx" accessSecret="M1NbbR1yxxhZLeKFn9p2tC9gHTfepSqCLDQ4yFGdW9iYk" consumerKey="i802werZQpXycOLedpek6u1g7" consumerSecret="kxIk7U5hJl0HkwJ1ZgfpID2RO02l09zpvHD3I3pgRGJF9sXQwr" doc:name="Twitter: Configuration"/>
  21. <http:listener-config name="HTTP_Listener_Configuration"
  22. host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration" />
  23.  
  24. <sub-flow name="dbtestFlowJSON">
  25. <db:select config-ref="MySQL_Configuration" doc:name="Database">
  26. <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>
  27. </db:select>
  28. <json:object-to-json-transformer doc:name="Object to JSON"/>
  29.  
  30. <file:outbound-endpoint path="C:\Users\gonca\AnypointStudio\workspace\dbtest" outputPattern="students.json" responseTimeout="10000" doc:name="File"/>
  31.  
  32. <json:json-to-object-transformer returnClass="java.util.List" doc:name="JSON to Object"/>
  33.  
  34.  
  35. <set-variable variableName="variable" value="#[message.payload]" doc:name="Variable"/>
  36.  
  37. <logger message="after variable:- #[variable.get(1).get('name')] " level="INFO" doc:name="Logger"/>
  38. <foreach collection="#[flowVars.variable]" doc:name="For Each">
  39. <logger message="LastName #[payload]" level="INFO" doc:name="Logger"/>
  40. </foreach>
  41. </sub-flow>
  42. <flow name="dbtestFlow">
  43. <quartz:inbound-endpoint jobName="Wait3" repeatInterval="5000" responseTimeout="10000" doc:name="Quartz3">
  44. <quartz:event-generator-job/>
  45. </quartz:inbound-endpoint>
  46. <db:select config-ref="MySQL_Configuration" doc:name="Database">
  47. <db:parameterized-query><![CDATA[select content, course_id from material;]]></db:parameterized-query>
  48. </db:select>
  49. <mulexml:object-to-xml-transformer doc:name="Object to XML"/>
  50. <file:outbound-endpoint path="C:\Users\gonca\Desktop" outputPattern="new.xml" responseTimeout="10000" doc:name="File"/>
  51. <scripting:transformer doc:name="Looking for differences" encoding="ISO-8859-2">
  52. <scripting:script engine="Groovy">
  53. <scripting:text><![CDATA[import dbtest.Helpers
  54. import dbtest.Message
  55. import dbtest.MessageToParse
  56.  
  57. Helpers.worker();
  58. ]]></scripting:text>
  59. </scripting:script>
  60. </scripting:transformer>
  61. <logger message="#[payload]" level="INFO" doc:name="Logger"/>
  62. <choice doc:name="Choice">
  63. <when expression="#[payload.size() &gt; 0]">
  64. <logger message="With changes" level="INFO" doc:name="Logger"/>
  65. <foreach doc:name="For Each">
  66. <set-variable variableName="changes" value="#[payload.getAddedMaterials()]" doc:name="Added Material"/>
  67. <set-variable variableName="removed" value="#[payload.getRemovedMaterials()] " doc:name="Removed Material"/>
  68. <set-variable variableName="course_id" value=" #[payload.getCourse_id()] " doc:name="Course"/>
  69. <flow-ref name="dbtestFlowJSON" doc:name="dbtestFlowJSON"/>
  70. <logger message="Ok Students found: #[flowVars.students] ----- Removed material: #[flowVars.removed]" level="INFO" doc:name="Logger"/>
  71. </foreach>
  72. </when>
  73. <otherwise>
  74. <logger message="Without changes" level="INFO" doc:name="Logger"/>
  75. <foreach doc:name="For Each">
  76. <logger message="#[payload.getRemovedMaterials()] #[payload.getCourse_id()] " level="INFO" doc:name="Logger"/>
  77. </foreach>
  78. </otherwise>
  79. </choice>
  80. </flow>
  81.  
  82. </mule>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement