SlideShare a Scribd company logo
By Anirban Sen Chowdhary
We often get a requirement of scheduling a task or monitoring some event
consistently when our application is running on server.
In that case we need to create a thread in our application that will constantly
monitor the event in our application and start the task after every fixed interval of
time.
In Mule we get plenty of options of doing it like using Quartz scheduler or Poll
component etc.
But what if we want to use our custom java class for that ???
Yes, we can do a scheduling and monitoring activity using a Java class and Spring
task scheduler in our Mule application….
Using spring task scheduler in java in mule
Let’s consider we have a simple Mule flow as following:-
Now, this is a simple flow where we will hit a url in the browser and it will send a
response to the browser and log the payload in console.
Now, we will also create a Java class here that will constantly load itself after the
application run in the server after every 10 sec and will print a message in console.
Let’s consider we our Java class is as following:-
This is a simple Java class that will log a message after every 10 seconds and will
be running in our application and will be monitoring in our application.
We can customize this class as per our requirement and put our own code here for
monitoring.
So far, I have kept it simple only to demonstrate the functionality
So here is our Spring configuration in the Mule config that will trigger this class
after every 10 second and keep the thread alive for monitoring and printing in the
console:-
Here you can see the Spring task scheduler is scheduling the Java class after every
10 sec. Also there is a Mule flow that will print the message in the browser and
console if we hit the url http://localhost:8082/test in browser
So if we run our application we will see the message after every 10 sec.:-
So if we hit url http://localhost:8082/test in browser we will get the following .:-
Also in the console we will get .:-
But the interesting fact is the Spring task scheduler is executing the Java class after
every 10 sec. So, using Java and Spring you can schedule and monitor events in
Mule which is an alternative to Quartz and Poll components
In my next slide I will bring some other techniques in Mule implementation .
Hope you have enjoyed this simpler version.
Keep sharing your knowledge and let our Mule community grow 
Using spring task scheduler in java in mule

More Related Content

PPTX
Quartz in Mule
PPTX
Using spring scheduler mule
PPTX
Composite source in bound and out-bound
PPTX
Mule with stored procedure
PPTX
Mule with quartz
PPTX
Mulesoft vm transport reference
PPTX
Mule with composite source
PPTX
Mule message enricher
Quartz in Mule
Using spring scheduler mule
Composite source in bound and out-bound
Mule with stored procedure
Mule with quartz
Mulesoft vm transport reference
Mule with composite source
Mule message enricher

What's hot (14)

PPTX
Scatter and gather in mule
PPTX
Scatter gather in mule
PPTX
Deploy apps in standalone with maven
PPTX
Mule soap
PPTX
Webservice vm in mule
PPTX
Mule quartz
PPTX
Accessing jms in mule using groovy
PPTX
Stored procedure in Mule
PPTX
Deploying and Running in Mule
PPTX
Scatter gather in mule
PPTX
Mule batch job
PPTX
Scheduling and monitoring with java in mule
PPTX
Idempotent filter in Mule
 
PPTX
Soap request in mule
Scatter and gather in mule
Scatter gather in mule
Deploy apps in standalone with maven
Mule soap
Webservice vm in mule
Mule quartz
Accessing jms in mule using groovy
Stored procedure in Mule
Deploying and Running in Mule
Scatter gather in mule
Mule batch job
Scheduling and monitoring with java in mule
Idempotent filter in Mule
 
Soap request in mule
Ad

Viewers also liked (14)

PPTX
Dynamic file attribute
PPTX
Mule with stored procedure
PPTX
RAMLing around with mule
PPTX
Idempotent filter with simple file
PPTX
Cloudhub in action
PPTX
RAMLing around with mule part2
PPTX
Mule MMC as a service
PPTX
Designing rest with raml
PPTX
Welcome data weave
PPTX
Xml to xml transformation in mule
PPTX
VM example in mule
PPTX
Getting anypoint studios all versions
PPTX
Accessing Mule variables in groovy
PPTX
Simple groovy example in mule
Dynamic file attribute
Mule with stored procedure
RAMLing around with mule
Idempotent filter with simple file
Cloudhub in action
RAMLing around with mule part2
Mule MMC as a service
Designing rest with raml
Welcome data weave
Xml to xml transformation in mule
VM example in mule
Getting anypoint studios all versions
Accessing Mule variables in groovy
Simple groovy example in mule
Ad

Similar to Using spring task scheduler in java in mule (20)

PPTX
Schedule and monitor in mule
PPTX
Quartz in mule
PPTX
Mule with quartz
PPTX
Mule with quartz
PPTX
Mule with quartz
PPTX
Mule with quartz
PPTX
Mule with quartz
PPTX
Mule with quartz
PPTX
Mule with quartz
PPTX
Quartz component
 
PPTX
Quartz component in mule
PPTX
Quartz component
PPTX
MMC control for failing flows consistently
PPTX
Mmc control for failing flows consistently
PPTX
Quartz component
PPTX
Baltimore july2021 final
PPTX
Mule quartz hari_gatadi
PPTX
Running mule from java
PPTX
Quartz component in mule demo
PPTX
Quartz in mule
Schedule and monitor in mule
Quartz in mule
Mule with quartz
Mule with quartz
Mule with quartz
Mule with quartz
Mule with quartz
Mule with quartz
Mule with quartz
Quartz component
 
Quartz component in mule
Quartz component
MMC control for failing flows consistently
Mmc control for failing flows consistently
Quartz component
Baltimore july2021 final
Mule quartz hari_gatadi
Running mule from java
Quartz component in mule demo
Quartz in mule

More from Anirban Sen Chowdhary (20)

PPTX
Change the game with Game changer
PPTX
Ring central desktop app overview
PPTX
Overview in ringcentral digital line
PPTX
Some basics with ring central
PPTX
Ring central and python
PPTX
RingCentral application development overview
PPTX
Cloze connect ringcentral
PPTX
Overview on ring central errors part 4
PPTX
Setting up your ring central sandbox in steps
PPTX
Overview on ring central errors: part 2
PPTX
Overview on ring central errors
PPTX
Call recording overview ring central
PPTX
Ring central engaging with amazon alexa
PPTX
How ring central sdk changing the game
PPTX
When ring central connect salesforce
PPTX
Mule 4 connecting ring central
PPTX
Ring central sdk
PPTX
Ring central with okta
PPTX
Ring central connecting salesforce overview
PPTX
Ring central call logs overview (part 2)
Change the game with Game changer
Ring central desktop app overview
Overview in ringcentral digital line
Some basics with ring central
Ring central and python
RingCentral application development overview
Cloze connect ringcentral
Overview on ring central errors part 4
Setting up your ring central sandbox in steps
Overview on ring central errors: part 2
Overview on ring central errors
Call recording overview ring central
Ring central engaging with amazon alexa
How ring central sdk changing the game
When ring central connect salesforce
Mule 4 connecting ring central
Ring central sdk
Ring central with okta
Ring central connecting salesforce overview
Ring central call logs overview (part 2)

Recently uploaded (20)

PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Modernizing your data center with Dell and AMD
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
A Presentation on Artificial Intelligence
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Encapsulation theory and applications.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Cloud computing and distributed systems.
PDF
KodekX | Application Modernization Development
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
The AUB Centre for AI in Media Proposal.docx
“AI and Expert System Decision Support & Business Intelligence Systems”
NewMind AI Monthly Chronicles - July 2025
MYSQL Presentation for SQL database connectivity
Encapsulation_ Review paper, used for researhc scholars
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Modernizing your data center with Dell and AMD
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Advanced methodologies resolving dimensionality complications for autism neur...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
A Presentation on Artificial Intelligence
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation theory and applications.pdf
Unlocking AI with Model Context Protocol (MCP)
Cloud computing and distributed systems.
KodekX | Application Modernization Development

Using spring task scheduler in java in mule

  • 1. By Anirban Sen Chowdhary
  • 2. We often get a requirement of scheduling a task or monitoring some event consistently when our application is running on server. In that case we need to create a thread in our application that will constantly monitor the event in our application and start the task after every fixed interval of time. In Mule we get plenty of options of doing it like using Quartz scheduler or Poll component etc. But what if we want to use our custom java class for that ???
  • 3. Yes, we can do a scheduling and monitoring activity using a Java class and Spring task scheduler in our Mule application….
  • 5. Let’s consider we have a simple Mule flow as following:- Now, this is a simple flow where we will hit a url in the browser and it will send a response to the browser and log the payload in console. Now, we will also create a Java class here that will constantly load itself after the application run in the server after every 10 sec and will print a message in console.
  • 6. Let’s consider we our Java class is as following:- This is a simple Java class that will log a message after every 10 seconds and will be running in our application and will be monitoring in our application. We can customize this class as per our requirement and put our own code here for monitoring. So far, I have kept it simple only to demonstrate the functionality
  • 7. So here is our Spring configuration in the Mule config that will trigger this class after every 10 second and keep the thread alive for monitoring and printing in the console:- Here you can see the Spring task scheduler is scheduling the Java class after every 10 sec. Also there is a Mule flow that will print the message in the browser and console if we hit the url http://localhost:8082/test in browser
  • 8. So if we run our application we will see the message after every 10 sec.:-
  • 9. So if we hit url http://localhost:8082/test in browser we will get the following .:-
  • 10. Also in the console we will get .:- But the interesting fact is the Spring task scheduler is executing the Java class after every 10 sec. So, using Java and Spring you can schedule and monitor events in Mule which is an alternative to Quartz and Poll components
  • 11. In my next slide I will bring some other techniques in Mule implementation . Hope you have enjoyed this simpler version. Keep sharing your knowledge and let our Mule community grow 