SlideShare a Scribd company logo
Using Quartz Connector
By Rahul Kumar
Prerequisites
Understanding of basic endpoints like http, file etc
Example : http://localhost:8081/app/b
file:///D/invoice/input
Understanding of CRON expressions
A good place to learn CRON expressions is
http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger.html
Quartz Connector
The Quartz Connector supports the scheduling of programmatic events, both inside and outside your Mule
flow. Through a quartz endpoint, you can trigger flows that don’t depend on receiving any external input to
execute at scheduled times.
For instance, an inbound Quartz endpoint can trigger inbound events, such as temperature reports from a
remote location, at regular intervals.
Outbound Quartz endpoints can delay otherwise imminent events. For example, you can prevent outgoing
email from being sent as soon as it has completed processing in your Mule flow. Instead, you can use
Quartz to delay sending it until the top of the next hour.
Inbound Quartz Endpoint
A Quartz inbound endpoint can be used to generate events. It is most useful when you want to trigger a
flow at a given interval (or cron expression) rather than have an external event trigger the flow.
Polling
Creating custom events
Polling with Quartz
The below Quartz endpoint polls for files using the “File” endpoint. It polls every 10 seconds starting at
12:15:00 PM everyday till 12:15:50 PM
<file:endpoint name="File" path="./src/main/resources/input" responseTimeout="10000"
doc:name="File"/>
<flow name="quartz-polling-with-incomingfile-in-folder">
<quartz:inbound-endpoint jobName="FilePollingJob" cronExpression="0/10 15 12 * * ?"
responseTimeout="10000" doc:name="Quartz" connector-ref="Quartz" repeatInterval="0">
<quartz:endpoint-polling-job>
<quartz:job-endpoint ref="File"/>
</quartz:endpoint-polling-job>
</quartz:inbound-endpoint>
</flow>
Example 2
The below Quartz endpoint executes a HTTP GET request to http://localhost:8081/app/b every 30
seconds starting at 11:05:00 AM till 11:05:30 AM
<flow name="quartz-polling-with-http-get-invoke">
<quartz:inbound-endpoint jobName="HTTPPollingJob" cronExpression="0/30 5 11 * * ?" connector-ref="Quartz"
responseTimeout="10000" doc:name="Quartz" repeatInterval="0">
<quartz:endpoint-polling-job>
<quartz:job-endpoint address="http://localhost:8081/app/b"/>
</quartz:endpoint-polling-job>
</quartz:inbound-endpoint>
</flow>
Generate Events with Quartz
The below Quartz endpoint creates an event which will post Payload “Event from Quartz !! ” every 10
seconds starting at 01:36:00 PM till 01:36:50 PM
<flow name="app7-3Flow1">
<quartz:inbound-endpoint jobName="SimpleEventCreateJob" cronExpression="0/10 36 13 * * ?" repeatInterval="0"
responseTimeout="10000" doc:name="Quartz">
<quartz:event-generator-job>
<quartz:payload>Event from Quartz !! </quartz:payload>
</quartz:event-generator-job>
</quartz:inbound-endpoint>
</flow>
Outbound Quartz Endpoint
An outbound Quartz endpoint allows existing events to be stored and fired at a later time/date.
Dispatching events
Dispatching custom events
Dispatching events with Quartz
Example 1
The below Quartz endpoint Invokes the job endpoint which is file i.e creates file several times according to
CRON expression that is starting at 01:43 PM at interval of 10 seconds till 01:43:50 PM
<file:endpoint path="./src/main/resources/output" name="File-Outbound-Endpoint" responseTimeout="10000"
doc:name="File"/> <flow name="quartz-schedule-dispatch-file">
<http:listener config-ref="HTTP_Listener_Configuration" path="/app/c" doc:name="HTTP"/>
<set-payload value="#['Payload for Dispatch !']" doc:name="Set Payload"/>
<quartz:outbound-endpoint jobName="FileDispatchJob" cronExpression="0/10 43 13 * * ?" connector-ref="Quartz"
responseTimeout="10000" doc:name="Quartz">
<quartz:scheduled-dispatch-job>
<quartz:job-endpoint ref="File-Outbound-Endpoint"/>
</quartz:scheduled-dispatch-job>
</quartz:outbound-endpoint>
</flow>
Custom Quartz Job
We can write our own Quartz job by implementing the org.quartz.Job
interface, this allows us to leverage Java to dispatch an event at the
scheduled time
Override the public void execute(JobExecutionContext
jobExecutionContext) throws JobExecutionException; - to define what
should happen when the job fires.
Need to give source in evaluator and name of the created java class in the
expression. This will trigger the execute() function of that class at the cron
specified time.
Example of Custom Quartz Job:
package org.rahul.quartz.job;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class CustomQuartzJob implements org.quartz.Job{
private String data;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
try {
FileOutputStream fos = new FileOutputStream("D:AnypointStudio-
5.4.3Workspaceapp7srcmainresourcesoutputoutput.txt");
fos.write(this.data.getBytes());
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
We have to pass an instance of the created Quartz job and supply it to the Quartz endpoint as evaluator and the fully qualified name
of the created Quartz Job in the expression field. For this example i have passed evaluator from the Payload.
Example Snippet below:
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
{
data: "Hello from Quartz!!"
} as :object {
class : "org.rahul.quartz.job.CustomQuartzJob"
}]]></dw:set-payload>
</dw:transform-message>
<quartz:outbound-endpoint jobName="customJob1" responseTimeout="10000" doc:name="Quartz" cronExpression="0/10 29 12
* * ?">
<quartz:custom-job-from-message evaluator="payload" expression="org.rahul.quartz.job.CustomQuartzJob" />
</quartz:outbound-endpoint>
References
https://docs.mulesoft.com/mule-user-guide/v/3.6/quartz-connector
https://docs.mulesoft.com/mule-user-guide/v/3.7/quartz-transport-reference

More Related Content

What's hot

Structured concurrency with Kotlin Coroutines
Structured concurrency with Kotlin CoroutinesStructured concurrency with Kotlin Coroutines
Structured concurrency with Kotlin Coroutines
Vadims Savjolovs
 
Automated testing with Openshift
Automated testing with OpenshiftAutomated testing with Openshift
Automated testing with Openshift
Oleg Popov
 
Odoo Online platform: architecture and challenges
Odoo Online platform: architecture and challengesOdoo Online platform: architecture and challenges
Odoo Online platform: architecture and challenges
Odoo
 
Introduction to Reactive Java
Introduction to Reactive JavaIntroduction to Reactive Java
Introduction to Reactive Java
Tomasz Kowalczewski
 
Structured Testing Framework
Structured Testing FrameworkStructured Testing Framework
Structured Testing Framework
serzar
 
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイルTrac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Shuji Watanabe
 
Kotlin Coroutines and Rx
Kotlin Coroutines and RxKotlin Coroutines and Rx
Kotlin Coroutines and Rx
Shaul Rosenzwieg
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Badoo Development
 
Continuous Integration for Fun and Profit
Continuous Integration for Fun and ProfitContinuous Integration for Fun and Profit
Continuous Integration for Fun and Profit
inovex GmbH
 
Node.js Lab
Node.js LabNode.js Lab
Node.js Lab
Leo Nguyen
 
Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...
Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...
Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...
Cloud Native Day Tel Aviv
 
Andro sec rl-prototype-finalproject
Andro sec rl-prototype-finalprojectAndro sec rl-prototype-finalproject
Andro sec rl-prototype-finalproject
LiadBercovich
 
Chap3 clientsrvr
Chap3 clientsrvrChap3 clientsrvr
Chap3 clientsrvr
Rachid Lajouad
 
Common Workflow Language (CWL) - George Carvalho
Common Workflow Language (CWL) -  George CarvalhoCommon Workflow Language (CWL) -  George Carvalho
Common Workflow Language (CWL) - George Carvalho
George Carvalho
 
Reactive Java (GeeCON 2014)
Reactive Java (GeeCON 2014)Reactive Java (GeeCON 2014)
Reactive Java (GeeCON 2014)
Tomasz Kowalczewski
 
Lopug docker end_of_distro
Lopug docker end_of_distroLopug docker end_of_distro
Lopug docker end_of_distro
Chris Swan
 
OB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
OB1K - New, Better, Faster, Devops Friendly Java container by OutbrainOB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
OB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
Eran Harel
 
Airflow Clustering and High Availability
Airflow Clustering and High AvailabilityAirflow Clustering and High Availability
Airflow Clustering and High Availability
Robert Sanders
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
Eran Harel
 
JavaCro'15 - Spring @Async - Dragan Juričić
JavaCro'15 - Spring @Async - Dragan JuričićJavaCro'15 - Spring @Async - Dragan Juričić

What's hot (20)

Structured concurrency with Kotlin Coroutines
Structured concurrency with Kotlin CoroutinesStructured concurrency with Kotlin Coroutines
Structured concurrency with Kotlin Coroutines
 
Automated testing with Openshift
Automated testing with OpenshiftAutomated testing with Openshift
Automated testing with Openshift
 
Odoo Online platform: architecture and challenges
Odoo Online platform: architecture and challengesOdoo Online platform: architecture and challenges
Odoo Online platform: architecture and challenges
 
Introduction to Reactive Java
Introduction to Reactive JavaIntroduction to Reactive Java
Introduction to Reactive Java
 
Structured Testing Framework
Structured Testing FrameworkStructured Testing Framework
Structured Testing Framework
 
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイルTrac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
Trac/Subversion/JUnit/Maven/Jenkinsで構築する開発スタイル
 
Kotlin Coroutines and Rx
Kotlin Coroutines and RxKotlin Coroutines and Rx
Kotlin Coroutines and Rx
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
 
Continuous Integration for Fun and Profit
Continuous Integration for Fun and ProfitContinuous Integration for Fun and Profit
Continuous Integration for Fun and Profit
 
Node.js Lab
Node.js LabNode.js Lab
Node.js Lab
 
Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...
Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...
Matthew Treinish, HP - subunit2sql: Tracking 1 Test Result in Millions, OpenS...
 
Andro sec rl-prototype-finalproject
Andro sec rl-prototype-finalprojectAndro sec rl-prototype-finalproject
Andro sec rl-prototype-finalproject
 
Chap3 clientsrvr
Chap3 clientsrvrChap3 clientsrvr
Chap3 clientsrvr
 
Common Workflow Language (CWL) - George Carvalho
Common Workflow Language (CWL) -  George CarvalhoCommon Workflow Language (CWL) -  George Carvalho
Common Workflow Language (CWL) - George Carvalho
 
Reactive Java (GeeCON 2014)
Reactive Java (GeeCON 2014)Reactive Java (GeeCON 2014)
Reactive Java (GeeCON 2014)
 
Lopug docker end_of_distro
Lopug docker end_of_distroLopug docker end_of_distro
Lopug docker end_of_distro
 
OB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
OB1K - New, Better, Faster, Devops Friendly Java container by OutbrainOB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
OB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
 
Airflow Clustering and High Availability
Airflow Clustering and High AvailabilityAirflow Clustering and High Availability
Airflow Clustering and High Availability
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
JavaCro'15 - Spring @Async - Dragan Juričić
JavaCro'15 - Spring @Async - Dragan JuričićJavaCro'15 - Spring @Async - Dragan Juričić
JavaCro'15 - Spring @Async - Dragan Juričić
 

Viewers also liked

使用 Quartz
使用 Quartz使用 Quartz
使用 Quartz
Gelis Wu
 
Spring Services
Spring ServicesSpring Services
Spring Services
Kasun Madusanke
 
Quartz in mule
Quartz in muleQuartz in mule
Quartz in mule
Manav Prasad
 
Quartz.NET - Enterprise Job Scheduler for .NET Platform
Quartz.NET - Enterprise Job Scheduler for .NET PlatformQuartz.NET - Enterprise Job Scheduler for .NET Platform
Quartz.NET - Enterprise Job Scheduler for .NET Platform
Guo Albert
 
Quartzでcronを範囲検索したい
Quartzでcronを範囲検索したいQuartzでcronを範囲検索したい
Quartzでcronを範囲検索したい
chibochibo
 
Using spring scheduler mule
Using spring scheduler muleUsing spring scheduler mule
Using spring scheduler mule
Son Nguyen
 
White Belt DMAIC Project Line G MTTR
White Belt DMAIC Project Line G  MTTRWhite Belt DMAIC Project Line G  MTTR
White Belt DMAIC Project Line G MTTRIrfan Rasheed Rana
 

Viewers also liked (7)

使用 Quartz
使用 Quartz使用 Quartz
使用 Quartz
 
Spring Services
Spring ServicesSpring Services
Spring Services
 
Quartz in mule
Quartz in muleQuartz in mule
Quartz in mule
 
Quartz.NET - Enterprise Job Scheduler for .NET Platform
Quartz.NET - Enterprise Job Scheduler for .NET PlatformQuartz.NET - Enterprise Job Scheduler for .NET Platform
Quartz.NET - Enterprise Job Scheduler for .NET Platform
 
Quartzでcronを範囲検索したい
Quartzでcronを範囲検索したいQuartzでcronを範囲検索したい
Quartzでcronを範囲検索したい
 
Using spring scheduler mule
Using spring scheduler muleUsing spring scheduler mule
Using spring scheduler mule
 
White Belt DMAIC Project Line G MTTR
White Belt DMAIC Project Line G  MTTRWhite Belt DMAIC Project Line G  MTTR
White Belt DMAIC Project Line G MTTR
 

Similar to Quartz connector

Spark Streaming Info
Spark Streaming InfoSpark Streaming Info
Spark Streaming Info
Doug Chang
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
Imre Nagi
 
Ondemand scaling-aws
Ondemand scaling-awsOndemand scaling-aws
Ondemand scaling-aws
Iegor Fadieiev
 
Behind modern concurrency primitives
Behind modern concurrency primitivesBehind modern concurrency primitives
Behind modern concurrency primitives
Bartosz Sypytkowski
 
Behind modern concurrency primitives
Behind modern concurrency primitivesBehind modern concurrency primitives
Behind modern concurrency primitives
Bartosz Sypytkowski
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
Dongmin Yu
 
Serverless Java on Kubernetes
Serverless Java on KubernetesServerless Java on Kubernetes
Serverless Java on Kubernetes
Krzysztof Sobkowiak
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and python
Chetan Giridhar
 
Sharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's FinagleSharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's Finagle
Geoff Ballinger
 
How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...
Priyobroto Ghosh (Mule ESB Certified)
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
Yevgeniy Brikman
 
[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless
KatyShimizu
 
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
KatyShimizu
 
Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & Jetpack
Nelson Glauber Leal
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Masahiro Nagano
 
Apache Beam de A à Z
 Apache Beam de A à Z Apache Beam de A à Z
Apache Beam de A à Z
Paris Data Engineers !
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
Oleg Podsechin
 
Load testing with Blitz
Load testing with BlitzLoad testing with Blitz
Load testing with Blitz
Lindsay Holmwood
 
2014 09 30_sparkling_water_hands_on
2014 09 30_sparkling_water_hands_on2014 09 30_sparkling_water_hands_on
2014 09 30_sparkling_water_hands_on
Sri Ambati
 

Similar to Quartz connector (20)

Spark Streaming Info
Spark Streaming InfoSpark Streaming Info
Spark Streaming Info
 
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache BeamGDG Jakarta Meetup - Streaming Analytics With Apache Beam
GDG Jakarta Meetup - Streaming Analytics With Apache Beam
 
Ondemand scaling-aws
Ondemand scaling-awsOndemand scaling-aws
Ondemand scaling-aws
 
Behind modern concurrency primitives
Behind modern concurrency primitivesBehind modern concurrency primitives
Behind modern concurrency primitives
 
Behind modern concurrency primitives
Behind modern concurrency primitivesBehind modern concurrency primitives
Behind modern concurrency primitives
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
Serverless Java on Kubernetes
Serverless Java on KubernetesServerless Java on Kubernetes
Serverless Java on Kubernetes
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and python
 
Sharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's FinagleSharding and Load Balancing in Scala - Twitter's Finagle
Sharding and Load Balancing in Scala - Twitter's Finagle
 
How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...How to execute an oracle stored procedure with nested table as a parameter fr...
How to execute an oracle stored procedure with nested table as a parameter fr...
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless
 
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
 
Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & Jetpack
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
Apache Beam de A à Z
 Apache Beam de A à Z Apache Beam de A à Z
Apache Beam de A à Z
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
Load testing with Blitz
Load testing with BlitzLoad testing with Blitz
Load testing with Blitz
 
2014 09 30_sparkling_water_hands_on
2014 09 30_sparkling_water_hands_on2014 09 30_sparkling_water_hands_on
2014 09 30_sparkling_water_hands_on
 

More from Rahul Kumar

Combine collections transformer
Combine collections transformerCombine collections transformer
Combine collections transformer
Rahul Kumar
 
Creating global functions
Creating global functionsCreating global functions
Creating global functions
Rahul Kumar
 
Creating custom object store
Creating custom object storeCreating custom object store
Creating custom object store
Rahul Kumar
 
Using parse template component
Using parse template componentUsing parse template component
Using parse template component
Rahul Kumar
 
Using groovy component
Using groovy componentUsing groovy component
Using groovy component
Rahul Kumar
 
Using expression component
Using expression componentUsing expression component
Using expression component
Rahul Kumar
 
Creating custom transformer
Creating custom transformerCreating custom transformer
Creating custom transformer
Rahul Kumar
 
Creating custom aggregation strategy
Creating custom aggregation strategyCreating custom aggregation strategy
Creating custom aggregation strategy
Rahul Kumar
 
Creating custom aggregator
Creating custom aggregatorCreating custom aggregator
Creating custom aggregator
Rahul Kumar
 
Byte array to hex string transformer
Byte array to hex string transformerByte array to hex string transformer
Byte array to hex string transformer
Rahul Kumar
 
Creating custom filter
Creating custom filterCreating custom filter
Creating custom filter
Rahul Kumar
 
Hex string to byte array transformer
Hex string to byte array transformerHex string to byte array transformer
Hex string to byte array transformer
Rahul Kumar
 
XML to DOM Transformer
XML to DOM TransformerXML to DOM Transformer
XML to DOM Transformer
Rahul Kumar
 
Dom to xml transformer
Dom to xml transformerDom to xml transformer
Dom to xml transformer
Rahul Kumar
 
Object to input stream transformer
Object to input stream transformerObject to input stream transformer
Object to input stream transformer
Rahul Kumar
 
Byte array to object transformer
Byte array to object transformerByte array to object transformer
Byte array to object transformer
Rahul Kumar
 
Byte array to string transformer
Byte array to string transformerByte array to string transformer
Byte array to string transformer
Rahul Kumar
 
Object to string transformer
Object to string transformerObject to string transformer
Object to string transformer
Rahul Kumar
 
Csv to json transform in simple steps
Csv to json transform in simple stepsCsv to json transform in simple steps
Csv to json transform in simple steps
Rahul Kumar
 
Using scatter gather
Using scatter gatherUsing scatter gather
Using scatter gather
Rahul Kumar
 

More from Rahul Kumar (20)

Combine collections transformer
Combine collections transformerCombine collections transformer
Combine collections transformer
 
Creating global functions
Creating global functionsCreating global functions
Creating global functions
 
Creating custom object store
Creating custom object storeCreating custom object store
Creating custom object store
 
Using parse template component
Using parse template componentUsing parse template component
Using parse template component
 
Using groovy component
Using groovy componentUsing groovy component
Using groovy component
 
Using expression component
Using expression componentUsing expression component
Using expression component
 
Creating custom transformer
Creating custom transformerCreating custom transformer
Creating custom transformer
 
Creating custom aggregation strategy
Creating custom aggregation strategyCreating custom aggregation strategy
Creating custom aggregation strategy
 
Creating custom aggregator
Creating custom aggregatorCreating custom aggregator
Creating custom aggregator
 
Byte array to hex string transformer
Byte array to hex string transformerByte array to hex string transformer
Byte array to hex string transformer
 
Creating custom filter
Creating custom filterCreating custom filter
Creating custom filter
 
Hex string to byte array transformer
Hex string to byte array transformerHex string to byte array transformer
Hex string to byte array transformer
 
XML to DOM Transformer
XML to DOM TransformerXML to DOM Transformer
XML to DOM Transformer
 
Dom to xml transformer
Dom to xml transformerDom to xml transformer
Dom to xml transformer
 
Object to input stream transformer
Object to input stream transformerObject to input stream transformer
Object to input stream transformer
 
Byte array to object transformer
Byte array to object transformerByte array to object transformer
Byte array to object transformer
 
Byte array to string transformer
Byte array to string transformerByte array to string transformer
Byte array to string transformer
 
Object to string transformer
Object to string transformerObject to string transformer
Object to string transformer
 
Csv to json transform in simple steps
Csv to json transform in simple stepsCsv to json transform in simple steps
Csv to json transform in simple steps
 
Using scatter gather
Using scatter gatherUsing scatter gather
Using scatter gather
 

Recently uploaded

Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 

Recently uploaded (20)

Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 

Quartz connector

  • 2. Prerequisites Understanding of basic endpoints like http, file etc Example : http://localhost:8081/app/b file:///D/invoice/input Understanding of CRON expressions A good place to learn CRON expressions is http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger.html
  • 3. Quartz Connector The Quartz Connector supports the scheduling of programmatic events, both inside and outside your Mule flow. Through a quartz endpoint, you can trigger flows that don’t depend on receiving any external input to execute at scheduled times. For instance, an inbound Quartz endpoint can trigger inbound events, such as temperature reports from a remote location, at regular intervals. Outbound Quartz endpoints can delay otherwise imminent events. For example, you can prevent outgoing email from being sent as soon as it has completed processing in your Mule flow. Instead, you can use Quartz to delay sending it until the top of the next hour.
  • 4. Inbound Quartz Endpoint A Quartz inbound endpoint can be used to generate events. It is most useful when you want to trigger a flow at a given interval (or cron expression) rather than have an external event trigger the flow. Polling Creating custom events
  • 5. Polling with Quartz The below Quartz endpoint polls for files using the “File” endpoint. It polls every 10 seconds starting at 12:15:00 PM everyday till 12:15:50 PM <file:endpoint name="File" path="./src/main/resources/input" responseTimeout="10000" doc:name="File"/> <flow name="quartz-polling-with-incomingfile-in-folder"> <quartz:inbound-endpoint jobName="FilePollingJob" cronExpression="0/10 15 12 * * ?" responseTimeout="10000" doc:name="Quartz" connector-ref="Quartz" repeatInterval="0"> <quartz:endpoint-polling-job> <quartz:job-endpoint ref="File"/> </quartz:endpoint-polling-job> </quartz:inbound-endpoint> </flow>
  • 6. Example 2 The below Quartz endpoint executes a HTTP GET request to http://localhost:8081/app/b every 30 seconds starting at 11:05:00 AM till 11:05:30 AM <flow name="quartz-polling-with-http-get-invoke"> <quartz:inbound-endpoint jobName="HTTPPollingJob" cronExpression="0/30 5 11 * * ?" connector-ref="Quartz" responseTimeout="10000" doc:name="Quartz" repeatInterval="0"> <quartz:endpoint-polling-job> <quartz:job-endpoint address="http://localhost:8081/app/b"/> </quartz:endpoint-polling-job> </quartz:inbound-endpoint> </flow>
  • 7. Generate Events with Quartz The below Quartz endpoint creates an event which will post Payload “Event from Quartz !! ” every 10 seconds starting at 01:36:00 PM till 01:36:50 PM <flow name="app7-3Flow1"> <quartz:inbound-endpoint jobName="SimpleEventCreateJob" cronExpression="0/10 36 13 * * ?" repeatInterval="0" responseTimeout="10000" doc:name="Quartz"> <quartz:event-generator-job> <quartz:payload>Event from Quartz !! </quartz:payload> </quartz:event-generator-job> </quartz:inbound-endpoint> </flow>
  • 8. Outbound Quartz Endpoint An outbound Quartz endpoint allows existing events to be stored and fired at a later time/date. Dispatching events Dispatching custom events
  • 9. Dispatching events with Quartz Example 1 The below Quartz endpoint Invokes the job endpoint which is file i.e creates file several times according to CRON expression that is starting at 01:43 PM at interval of 10 seconds till 01:43:50 PM <file:endpoint path="./src/main/resources/output" name="File-Outbound-Endpoint" responseTimeout="10000" doc:name="File"/> <flow name="quartz-schedule-dispatch-file"> <http:listener config-ref="HTTP_Listener_Configuration" path="/app/c" doc:name="HTTP"/> <set-payload value="#['Payload for Dispatch !']" doc:name="Set Payload"/> <quartz:outbound-endpoint jobName="FileDispatchJob" cronExpression="0/10 43 13 * * ?" connector-ref="Quartz" responseTimeout="10000" doc:name="Quartz"> <quartz:scheduled-dispatch-job> <quartz:job-endpoint ref="File-Outbound-Endpoint"/> </quartz:scheduled-dispatch-job> </quartz:outbound-endpoint> </flow>
  • 10. Custom Quartz Job We can write our own Quartz job by implementing the org.quartz.Job interface, this allows us to leverage Java to dispatch an event at the scheduled time Override the public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException; - to define what should happen when the job fires. Need to give source in evaluator and name of the created java class in the expression. This will trigger the execute() function of that class at the cron specified time.
  • 11. Example of Custom Quartz Job: package org.rahul.quartz.job; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; public class CustomQuartzJob implements org.quartz.Job{ private String data; public String getData() { return data; } public void setData(String data) { this.data = data; } @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { try { FileOutputStream fos = new FileOutputStream("D:AnypointStudio- 5.4.3Workspaceapp7srcmainresourcesoutputoutput.txt"); fos.write(this.data.getBytes()); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
  • 12. We have to pass an instance of the created Quartz job and supply it to the Quartz endpoint as evaluator and the fully qualified name of the created Quartz Job in the expression field. For this example i have passed evaluator from the Payload. Example Snippet below: <dw:transform-message doc:name="Transform Message"> <dw:set-payload><![CDATA[%dw 1.0 %output application/java --- { data: "Hello from Quartz!!" } as :object { class : "org.rahul.quartz.job.CustomQuartzJob" }]]></dw:set-payload> </dw:transform-message> <quartz:outbound-endpoint jobName="customJob1" responseTimeout="10000" doc:name="Quartz" cronExpression="0/10 29 12 * * ?"> <quartz:custom-job-from-message evaluator="payload" expression="org.rahul.quartz.job.CustomQuartzJob" /> </quartz:outbound-endpoint>

Editor's Notes

  1. Understanding of basic endpoints like http, file etc Example : http://localhost:8081/app/b file:///D/invoice/input Understanding of CRON expressions A good place to learn CRON expressions is http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger.html
  2. The Quartz Connector supports the scheduling of programmatic events, both inside and outside your Mule flow. Through a quartz endpoint, you can trigger flows that don’t depend on receiving any external input to execute at scheduled times. For instance, an inbound Quartz endpoint can trigger inbound events, such as temperature reports from a remote location, at regular intervals. Outbound Quartz endpoints can delay otherwise imminent events. For example, you can prevent outgoing email from being sent as soon as it has completed processing in your Mule flow. Instead, you can use Quartz to delay sending it until the top of the next hour.
  3. A Quartz inbound endpoint can be used to generate events. It is most useful when you want to trigger a flow at a given interval (or cron expression) rather than have an external event trigger the flow. Polling Creating custom events
  4. The below Quartz endpoint polls for files using the “File” endpoint. It polls every 10 seconds starting at 12:15:00 PM everyday till 12:15:50 PM <file:endpoint name="File" path="./src/main/resources/input" responseTimeout="10000" doc:name="File"/> <flow name="quartz-polling-with-incomingfile-in-folder"> <quartz:inbound-endpoint jobName="FilePollingJob" cronExpression="0/10 15 12 * * ?" responseTimeout="10000" doc:name="Quartz" connector-ref="Quartz" repeatInterval="0"> <quartz:endpoint-polling-job> <quartz:job-endpoint ref="File"/> </quartz:endpoint-polling-job> </quartz:inbound-endpoint> </flow>
  5. Example 2 The below Quartz endpoint executes a HTTP GET request to http://localhost:8081/app/b every 30 seconds starting at 11:05:00 AM till 11:05:30 AM <flow name="quartz-polling-with-http-get-invoke"> <quartz:inbound-endpoint jobName="HTTPPollingJob" cronExpression="0/30 5 11 * * ?" connector-ref="Quartz" responseTimeout="10000" doc:name="Quartz" repeatInterval="0"> <quartz:endpoint-polling-job> <quartz:job-endpoint address="http://localhost:8081/app/b"/> </quartz:endpoint-polling-job> </quartz:inbound-endpoint> </flow>
  6. The below Quartz endpoint creates an event which will post Payload “Event from Quartz !! ” every 10 seconds starting at 01:36:00 PM till 01:36:50 PM <flow name="app7-3Flow1"> <quartz:inbound-endpoint jobName="SimpleEventCreateJob" cronExpression="0/10 36 13 * * ?" repeatInterval="0" responseTimeout="10000" doc:name="Quartz"> <quartz:event-generator-job> <quartz:payload>Event from Quartz !! </quartz:payload> </quartz:event-generator-job> </quartz:inbound-endpoint> </flow>
  7. An outbound Quartz endpoint allows existing events to be stored and fired at a later time/date. Dispatching events Dispatching custom events
  8. Example 1 The below Quartz endpoint Invokes the job endpoint which is file i.e creates file several times according to CRON expression that is starting at 01:43 PM at interval of 10 seconds till 01:43:50 PM <file:endpoint path="./src/main/resources/output" name="File-Outbound-Endpoint" responseTimeout="10000" doc:name="File"/> <flow name="quartz-schedule-dispatch-file"> <http:listener config-ref="HTTP_Listener_Configuration" path="/app/c" doc:name="HTTP"/> <set-payload value="#['Payload for Dispatch !']" doc:name="Set Payload"/> <quartz:outbound-endpoint jobName="FileDispatchJob" cronExpression="0/10 43 13 * * ?" connector-ref="Quartz" responseTimeout="10000" doc:name="Quartz"> <quartz:scheduled-dispatch-job> <quartz:job-endpoint ref="File-Outbound-Endpoint"/> </quartz:scheduled-dispatch-job> </quartz:outbound-endpoint> </flow>
  9. We can write our own Quartz job by implementing the org.quartz.Job interface, this allows us to leverage Java to dispatch an event at the scheduled time Override the public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException; - to define what should happen when the job fires. Need to give source in evaluator and name of the created java class in the expression. This will trigger the execute() function of that class at the cron specified time.
  10. Example of Custom Quartz Job: package org.rahul.quartz.job; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; public class CustomQuartzJob implements org.quartz.Job{ private String data; public String getData() { return data; } public void setData(String data) { this.data = data; } @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { try { FileOutputStream fos = new FileOutputStream("D:\\AnypointStudio-5.4.3\\Workspace\\app7\\src\\main\\resources\\output\\output.txt"); fos.write(this.data.getBytes()); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
  11. We have to pass an instance of the created Quartz job and supply it to the Quartz endpoint as evaluator and the fully qualified name of the created Quartz Job in the expression field. For this example i have passed evaluator from the Payload. Example Snippet below: <dw:transform-message doc:name="Transform Message"> <dw:set-payload><![CDATA[%dw 1.0 %output application/java --- { data: "Hello from Quartz!!" } as :object { class : "org.rahul.quartz.job.CustomQuartzJob" }]]></dw:set-payload> </dw:transform-message> <quartz:outbound-endpoint jobName="customJob1" responseTimeout="10000" doc:name="Quartz" cronExpression="0/10 29 12 * * ?"> <quartz:custom-job-from-message evaluator="payload" expression="org.rahul.quartz.job.CustomQuartzJob" /> </quartz:outbound-endpoint>
  12. https://docs.mulesoft.com/mule-user-guide/v/3.6/quartz-connector https://docs.mulesoft.com/mule-user-guide/v/3.7/quartz-transport-reference