SlideShare uma empresa Scribd logo
1 de 12
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….
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

Mais conteúdo relacionado

Mais procurados (14)

Scatter and gather in mule
Scatter and gather in muleScatter and gather in mule
Scatter and gather in mule
 
Scatter gather in mule
Scatter gather in muleScatter gather in mule
Scatter gather in mule
 
Deploy apps in standalone with maven
Deploy apps in standalone with mavenDeploy apps in standalone with maven
Deploy apps in standalone with maven
 
Mule soap
Mule soapMule soap
Mule soap
 
Webservice vm in mule
Webservice vm in muleWebservice vm in mule
Webservice vm in mule
 
Mule quartz
Mule quartz Mule quartz
Mule quartz
 
Accessing jms in mule using groovy
Accessing jms in mule using groovyAccessing jms in mule using groovy
Accessing jms in mule using groovy
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure in Mule
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in Mule
 
Scatter gather in mule
Scatter gather in muleScatter gather in mule
Scatter gather in mule
 
Mule batch job
Mule batch jobMule batch job
Mule batch job
 
Scheduling and monitoring with java in mule
Scheduling and monitoring with java in muleScheduling and monitoring with java in mule
Scheduling and monitoring with java in mule
 
Idempotent filter in Mule
Idempotent filter in MuleIdempotent filter in Mule
Idempotent filter in Mule
 
Soap request in mule
Soap request in mule Soap request in mule
Soap request in mule
 

Destaque

Destaque (14)

Dynamic file attribute
Dynamic file attributeDynamic file attribute
Dynamic file attribute
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
RAMLing around with mule
RAMLing around with muleRAMLing around with mule
RAMLing around with mule
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple file
 
Cloudhub in action
Cloudhub in actionCloudhub in action
Cloudhub in action
 
RAMLing around with mule part2
RAMLing around with mule part2RAMLing around with mule part2
RAMLing around with mule part2
 
Mule MMC as a service
Mule MMC as a serviceMule MMC as a service
Mule MMC as a service
 
Designing rest with raml
Designing rest with ramlDesigning rest with raml
Designing rest with raml
 
Welcome data weave
Welcome data weaveWelcome data weave
Welcome data weave
 
Xml to xml transformation in mule
Xml to xml transformation in muleXml to xml transformation in mule
Xml to xml transformation in mule
 
VM example in mule
VM example in muleVM example in mule
VM example in mule
 
Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versions
 
Accessing Mule variables in groovy
Accessing Mule variables in groovyAccessing Mule variables in groovy
Accessing Mule variables in groovy
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in mule
 

Semelhante a Using spring task scheduler in java in mule

Semelhante a Using spring task scheduler in java in mule (20)

Schedule and monitor in mule
Schedule and monitor in muleSchedule and monitor in mule
Schedule and monitor in mule
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community edition
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community edition
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition
 
Community edition Cache
Community edition CacheCommunity edition Cache
Community edition Cache
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community edition
 
Cache community edition
Cache community edition Cache community edition
Cache community edition
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community edition
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community edition
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community edition
 
Deploying and running in mule standalone
Deploying and running in mule standaloneDeploying and running in mule standalone
Deploying and running in mule standalone
 
Deploying and running in mule standalone
Deploying and running in mule standaloneDeploying and running in mule standalone
Deploying and running in mule standalone
 
Deploying and running in mule standalone
Deploying and running in mule standaloneDeploying and running in mule standalone
Deploying and running in mule standalone
 
Deploying and running in mule standalone
Deploying and running in mule standaloneDeploying and running in mule standalone
Deploying and running in mule standalone
 
Deploying and running mule standalone
Deploying and running mule standaloneDeploying and running mule standalone
Deploying and running mule standalone
 
Deploy with maven
Deploy with mavenDeploy with maven
Deploy with maven
 
Running mule standalone
Running mule standaloneRunning mule standalone
Running mule standalone
 
Stored procedure in mule
Stored procedure in muleStored procedure in mule
Stored procedure in mule
 

Mais de Anirban Sen Chowdhary

Mais de Anirban Sen Chowdhary (20)

Change the game with Game changer
Change the game with Game changerChange the game with Game changer
Change the game with Game changer
 
Ring central desktop app overview
Ring central desktop app overviewRing central desktop app overview
Ring central desktop app overview
 
Overview in ringcentral digital line
Overview in ringcentral digital lineOverview in ringcentral digital line
Overview in ringcentral digital line
 
Some basics with ring central
Some basics with ring centralSome basics with ring central
Some basics with ring central
 
Ring central and python
Ring central and pythonRing central and python
Ring central and python
 
RingCentral application development overview
RingCentral application development overviewRingCentral application development overview
RingCentral application development overview
 
Cloze connect ringcentral
Cloze connect ringcentralCloze connect ringcentral
Cloze connect ringcentral
 
Overview on ring central errors part 4
Overview on ring central errors part 4Overview on ring central errors part 4
Overview on ring central errors part 4
 
Setting up your ring central sandbox in steps
Setting up your ring central sandbox in stepsSetting up your ring central sandbox in steps
Setting up your ring central sandbox in steps
 
Overview on ring central errors: part 2
Overview on ring central errors: part 2Overview on ring central errors: part 2
Overview on ring central errors: part 2
 
Overview on ring central errors
Overview on ring central errorsOverview on ring central errors
Overview on ring central errors
 
Call recording overview ring central
Call recording overview  ring centralCall recording overview  ring central
Call recording overview ring central
 
Ring central engaging with amazon alexa
Ring central engaging with amazon alexaRing central engaging with amazon alexa
Ring central engaging with amazon alexa
 
How ring central sdk changing the game
How ring central sdk changing the gameHow ring central sdk changing the game
How ring central sdk changing the game
 
When ring central connect salesforce
When ring central connect salesforceWhen ring central connect salesforce
When ring central connect salesforce
 
Mule 4 connecting ring central
Mule 4 connecting ring centralMule 4 connecting ring central
Mule 4 connecting ring central
 
Ring central sdk
Ring central sdkRing central sdk
Ring central sdk
 
Ring central with okta
Ring central with oktaRing central with okta
Ring central with okta
 
Ring central connecting salesforce overview
Ring central connecting salesforce overviewRing central connecting salesforce overview
Ring central connecting salesforce overview
 
Ring central call logs overview (part 2)
Ring central call logs overview (part 2)Ring central call logs overview (part 2)
Ring central call logs overview (part 2)
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 

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….
  • 4.
  • 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 