Skip to content

Instantly share code, notes, and snippets.

@sdeepaks
Created November 28, 2017 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdeepaks/0feefd784b2f8b95628012201d8ac45b to your computer and use it in GitHub Desktop.
Save sdeepaks/0feefd784b2f8b95628012201d8ac45b to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:mulerequester="http://www.mulesoft.org/schema/mule/mulerequester" xmlns:synchronize="http://www.mulesoft.org/schema/mule/synchronize"
xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:batch="http://www.mulesoft.org/schema/mule/batch" 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.mulesoft.org/schema/mule/synchronize http://www.mulesoft.org/schema/mule/synchronize/current/mule-synchronize.xsd
http://www.springfr amework.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/batch http://www.mulesoft.org/schema/mule/batch/current/mule-batch.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.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/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/mulerequester http://www.mulesoft.org/schema/mule/mulerequester/current/mule-mulerequester.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8088" doc:name="HTTP Listener Configuration"/>
<vm:connector name="VM1" validateConnections="true" doc:name="VM"/>
<vm:endpoint exchange-pattern="one-way" path="test-queue-data" connector-ref="VM1" name="VM" doc:name="VM"/>
<flow name="flow1">
<http:listener config-ref="HTTP_Listener_Configuration" path="/execute" doc:name="HTTP"/>
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
[
{name:'dpk'},
{name:"mht"}
]]]></dw:set-payload>
</dw:transform-message>
<synchronize:run-and-wait timeout="16000" doc:name="Synchronize">
<flow-ref name="flow2" doc:name="flow2"/>
</synchronize:run-and-wait>
<mulerequester:request resource="VM" doc:name="Mule Requester"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
<flow name="flow2">
<batch:execute name="testbatchBatch" doc:name="testbatchBatch"/>
</flow>
<batch:job name="testbatchBatch" max-failed-records="3">
<batch:process-records>
<batch:step name="Batch_Step">
<logger message="1" level="INFO" doc:name="Logger"/>
</batch:step>
<batch:step name="Batch_Step1">
<logger message="2" level="INFO" doc:name="Logger"/>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[Thread.sleep(6000);]]></scripting:script>
</scripting:transformer>
</batch:step>
<batch:step name="Batch_Step2">
<logger message="3" level="INFO" doc:name="Logger"/>
<scripting:transformer doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[throw new java.lang.Exception("Test");]]></scripting:script>
</scripting:transformer>
</batch:step>
</batch:process-records>
<batch:on-complete>
<set-payload value="#[payload.successfulRecords]
#[payload.failedRecords]" doc:name="Set Payload"/>
<vm:outbound-endpoint exchange-pattern="one-way" path="test-queue-data" connector-ref="VM1" doc:name="VM"/>
</batch:on-complete>
</batch:job>
</mule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment