SlideShare une entreprise Scribd logo
1  sur  13
Simple Groovy example in Mule
We often want to stop our flow for sometime and then want
to process it after an interval of time.
In Java we can use Sleep method to hold our thread for a
specific period of time
But how can we use Sleep method in Mule??
.
Here I will show you how ……
Let us consider we have a following Mule flow :-
Now you can see in the above flow the inbound endpoint will pic a file from a
location and put it into another location.
But what if we want to hold the flow for sometime before it put the file in the
outbound location ???
How can we hold the file for an particular interval of time ???
Yes .. We can do it by using sleep method in our flow
So, we need Groovy component to implement sleep method:-
So our Mule flow will be now following :-
This Groovy component will be holding the payload for some time
The corresponding Mule flow will be :-
<file:connector name="File_Global" autoDelete="true" outputAppend="true" streaming="true"
validateConnections="true" doc:name="File"/>
<flow name="Flow1" doc:name="Flow1">
<file:inbound-endpoint path="E:backuptest" responseTimeout="10000" doc:name="File" connector-
ref="File_Global">
<file:filename-regex-filter pattern="abc.txt" caseSensitive="false"/>
</file:inbound-endpoint>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy">
<![CDATA[
sleep(3000);
System.out.println("Holding the flow for 3000 ms");
return message.payload;]]>
</scripting:script>
</scripting:component>
<file:outbound-endpoint path="E:backuptestnewfolder" responseTimeout="10000" doc:name="File"/>
</flow>
So, if we start our application again and put the inbound file in the location
E:backuptest , we will get the following in our console :-
And we will get the file in our outbound location E:backuptestnewfolder
after 3000 ms
Hope you enjoyed the simple yet an amazing trick in Mule
Simple Groovy Sleep Example in Mule

Contenu connexe

Tendances (11)

Simple Java component in Mule
Simple Java component in MuleSimple Java component in Mule
Simple Java component in Mule
 
Groovy example in mule
Groovy example in muleGroovy example in mule
Groovy example in mule
 
Mulesoft Using Groovy Component
Mulesoft Using Groovy ComponentMulesoft Using Groovy Component
Mulesoft Using Groovy Component
 
Groovy in Mule
Groovy in MuleGroovy in Mule
Groovy in Mule
 
Accessing jms in mule using groovy
Accessing jms in mule using groovyAccessing jms in mule using groovy
Accessing jms in mule using groovy
 
Initialize database in Mule part2
Initialize database in Mule part2Initialize database in Mule part2
Initialize database in Mule part2
 
Encrypting/Decrypting mule
Encrypting/Decrypting  muleEncrypting/Decrypting  mule
Encrypting/Decrypting mule
 
Mule message enricher
Mule message enricherMule message enricher
Mule message enricher
 
Mule quartz
Mule quartz Mule quartz
Mule quartz
 
Holding a mule flow
Holding a mule flowHolding a mule flow
Holding a mule flow
 
Timer Interceptor in Mule part 2
Timer Interceptor in Mule part 2Timer Interceptor in Mule part 2
Timer Interceptor in Mule part 2
 

En vedette

Dubai bus rentals
Dubai bus rentalsDubai bus rentals
Dubai bus rentalsarabiandre2
 
Pmi pmbok-resume template-17
Pmi pmbok-resume template-17Pmi pmbok-resume template-17
Pmi pmbok-resume template-17vishvasyadav45
 
The groopify journey - EDEM - Pablo Viguera (groopify)
The groopify journey - EDEM - Pablo Viguera (groopify)The groopify journey - EDEM - Pablo Viguera (groopify)
The groopify journey - EDEM - Pablo Viguera (groopify)Groopify
 
Роль представителей общественности в ККС
Роль представителей общественности в ККСРоль представителей общественности в ККС
Роль представителей общественности в ККСVadim Karastelev
 
Drupal usage by example : World Food Programme
Drupal usage by example : World Food ProgrammeDrupal usage by example : World Food Programme
Drupal usage by example : World Food ProgrammeAdyax
 
клавиатура.основные приемы и назначения
клавиатура.основные приемы и назначенияклавиатура.основные приемы и назначения
клавиатура.основные приемы и назначенияVitusKK
 
J O B S I
J  O  B  S  IJ  O  B  S  I
J O B S Ikeydiva
 
Clcbrochure12 13 email
Clcbrochure12 13 emailClcbrochure12 13 email
Clcbrochure12 13 emailCLCbcarrasco
 
Decisão TJPE - Greve dos Professores do Recife
Decisão TJPE - Greve dos Professores do RecifeDecisão TJPE - Greve dos Professores do Recife
Decisão TJPE - Greve dos Professores do RecifeAnna Tiago
 
Jess-Jingle Renewal of Vows
Jess-Jingle Renewal of VowsJess-Jingle Renewal of Vows
Jess-Jingle Renewal of Vowsjess92871
 
Domestic Demand, Import Demand & Export Demand for Passenger Automobiles in I...
Domestic Demand, Import Demand & Export Demand for Passenger Automobiles in I...Domestic Demand, Import Demand & Export Demand for Passenger Automobiles in I...
Domestic Demand, Import Demand & Export Demand for Passenger Automobiles in I...vivekmsk29
 
REALOGY8K11808
REALOGY8K11808REALOGY8K11808
REALOGY8K11808finance35
 

En vedette (19)

Dubai bus rentals
Dubai bus rentalsDubai bus rentals
Dubai bus rentals
 
Pmi pmbok-resume template-17
Pmi pmbok-resume template-17Pmi pmbok-resume template-17
Pmi pmbok-resume template-17
 
Dílna krásy
Dílna krásyDílna krásy
Dílna krásy
 
The Big Picture, March 2014
The Big Picture, March 2014The Big Picture, March 2014
The Big Picture, March 2014
 
Slide share
Slide shareSlide share
Slide share
 
The groopify journey - EDEM - Pablo Viguera (groopify)
The groopify journey - EDEM - Pablo Viguera (groopify)The groopify journey - EDEM - Pablo Viguera (groopify)
The groopify journey - EDEM - Pablo Viguera (groopify)
 
Роль представителей общественности в ККС
Роль представителей общественности в ККСРоль представителей общественности в ККС
Роль представителей общественности в ККС
 
Drupal usage by example : World Food Programme
Drupal usage by example : World Food ProgrammeDrupal usage by example : World Food Programme
Drupal usage by example : World Food Programme
 
клавиатура.основные приемы и назначения
клавиатура.основные приемы и назначенияклавиатура.основные приемы и назначения
клавиатура.основные приемы и назначения
 
Social Website
Social WebsiteSocial Website
Social Website
 
"may the force be with you"
"may the force be with you""may the force be with you"
"may the force be with you"
 
J O B S I
J  O  B  S  IJ  O  B  S  I
J O B S I
 
Clcbrochure12 13 email
Clcbrochure12 13 emailClcbrochure12 13 email
Clcbrochure12 13 email
 
Decisão TJPE - Greve dos Professores do Recife
Decisão TJPE - Greve dos Professores do RecifeDecisão TJPE - Greve dos Professores do Recife
Decisão TJPE - Greve dos Professores do Recife
 
Jess-Jingle Renewal of Vows
Jess-Jingle Renewal of VowsJess-Jingle Renewal of Vows
Jess-Jingle Renewal of Vows
 
Domestic Demand, Import Demand & Export Demand for Passenger Automobiles in I...
Domestic Demand, Import Demand & Export Demand for Passenger Automobiles in I...Domestic Demand, Import Demand & Export Demand for Passenger Automobiles in I...
Domestic Demand, Import Demand & Export Demand for Passenger Automobiles in I...
 
Cmmaao budget-pmi-pmp
Cmmaao budget-pmi-pmpCmmaao budget-pmi-pmp
Cmmaao budget-pmi-pmp
 
Ogilvy Jay Chiat Winners 2012
Ogilvy Jay Chiat Winners 2012Ogilvy Jay Chiat Winners 2012
Ogilvy Jay Chiat Winners 2012
 
REALOGY8K11808
REALOGY8K11808REALOGY8K11808
REALOGY8K11808
 

Similaire à Simple Groovy Sleep Example in Mule

Groovy with mule
Groovy with muleGroovy with mule
Groovy with muleHasan Syed
 
Handle File on mule
Handle File on muleHandle File on mule
Handle File on muleSon Nguyen
 
Schedule and monitor in mule
Schedule and monitor in muleSchedule and monitor in mule
Schedule and monitor in muleSon Nguyen
 
Using spring scheduler mule
Using spring scheduler muleUsing spring scheduler mule
Using spring scheduler muleSon Nguyen
 
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 muleAnirban Sen Chowdhary
 
Using spring task scheduler in java in mule
Using spring task scheduler in java in muleUsing spring task scheduler in java in mule
Using spring task scheduler in java in muleAnirban Sen Chowdhary
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored proceduremdfkhan625
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedurejaveed_mhd
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedureMohammed625
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure in MuleKhasim Saheb
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community editionirfan1008
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community editionSunil Komarapu
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community editionHasan Syed
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community editionMohammed246
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition javeed_mhd
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition mdfkhan625
 
Cache for community edition
Cache for community edition Cache for community edition
Cache for community edition Khasim Saheb
 

Similaire à Simple Groovy Sleep Example in Mule (20)

Groovy with mule
Groovy with muleGroovy with mule
Groovy with mule
 
Groovy with mule
Groovy with muleGroovy with mule
Groovy with mule
 
Handle File on mule
Handle File on muleHandle File on mule
Handle File on mule
 
Schedule and monitor in mule
Schedule and monitor in muleSchedule and monitor in mule
Schedule and monitor in mule
 
Using spring scheduler mule
Using spring scheduler muleUsing spring scheduler mule
Using spring scheduler mule
 
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
 
Using spring task scheduler in java in mule
Using spring task scheduler in java in muleUsing spring task scheduler in java in mule
Using spring task scheduler in java in mule
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
Mule stored procedure
Mule stored procedureMule stored procedure
Mule stored procedure
 
Mule with stored procedure
Mule with stored procedureMule with stored procedure
Mule with stored procedure
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure 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 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
 
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
 
Community edition Cache
Community edition CacheCommunity edition Cache
Community edition Cache
 

Plus de Khan625

Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in muleKhan625
 
Message properties component in Mule
Message properties component in MuleMessage properties component in Mule
Message properties component in MuleKhan625
 
Jenkins Build System
Jenkins Build SystemJenkins Build System
Jenkins Build SystemKhan625
 
Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with MavenKhan625
 
Web services soap
Web services soapWeb services soap
Web services soapKhan625
 
Web services wsdl
Web services wsdlWeb services wsdl
Web services wsdlKhan625
 
Web services uddi
Web services uddiWeb services uddi
Web services uddiKhan625
 
Web services with soap
Web services with soapWeb services with soap
Web services with soapKhan625
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic OverviewKhan625
 
Java Basics
Java BasicsJava Basics
Java BasicsKhan625
 
Mmc rest api user groups
Mmc rest api user groupsMmc rest api user groups
Mmc rest api user groupsKhan625
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with muleKhan625
 
Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in muleKhan625
 
Expression filter in Mule
Expression filter in MuleExpression filter in Mule
Expression filter in MuleKhan625
 
Data weave
Data weave Data weave
Data weave Khan625
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gatewayKhan625
 
Mule with drools
Mule with droolsMule with drools
Mule with droolsKhan625
 
Mule esb
Mule esbMule esb
Mule esbKhan625
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple fileKhan625
 

Plus de Khan625 (20)

Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in mule
 
Message properties component in Mule
Message properties component in MuleMessage properties component in Mule
Message properties component in Mule
 
Jenkins Build System
Jenkins Build SystemJenkins Build System
Jenkins Build System
 
Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with Maven
 
Web services soap
Web services soapWeb services soap
Web services soap
 
Web services wsdl
Web services wsdlWeb services wsdl
Web services wsdl
 
Web services uddi
Web services uddiWeb services uddi
Web services uddi
 
Web services with soap
Web services with soapWeb services with soap
Web services with soap
 
Maven
Maven Maven
Maven
 
WebServices Basic Overview
WebServices Basic OverviewWebServices Basic Overview
WebServices Basic Overview
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Mmc rest api user groups
Mmc rest api user groupsMmc rest api user groups
Mmc rest api user groups
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
Message properties component in mule
Message properties component in muleMessage properties component in mule
Message properties component in mule
 
Expression filter in Mule
Expression filter in MuleExpression filter in Mule
Expression filter in Mule
 
Data weave
Data weave Data weave
Data weave
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
Mule with drools
Mule with droolsMule with drools
Mule with drools
 
Mule esb
Mule esbMule esb
Mule esb
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple file
 

Dernier

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Dernier (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Simple Groovy Sleep Example in Mule

  • 2. We often want to stop our flow for sometime and then want to process it after an interval of time. In Java we can use Sleep method to hold our thread for a specific period of time
  • 3. But how can we use Sleep method in Mule?? .
  • 4. Here I will show you how ……
  • 5. Let us consider we have a following Mule flow :- Now you can see in the above flow the inbound endpoint will pic a file from a location and put it into another location. But what if we want to hold the flow for sometime before it put the file in the outbound location ??? How can we hold the file for an particular interval of time ???
  • 6. Yes .. We can do it by using sleep method in our flow
  • 7. So, we need Groovy component to implement sleep method:-
  • 8. So our Mule flow will be now following :- This Groovy component will be holding the payload for some time
  • 9. The corresponding Mule flow will be :- <file:connector name="File_Global" autoDelete="true" outputAppend="true" streaming="true" validateConnections="true" doc:name="File"/> <flow name="Flow1" doc:name="Flow1"> <file:inbound-endpoint path="E:backuptest" responseTimeout="10000" doc:name="File" connector- ref="File_Global"> <file:filename-regex-filter pattern="abc.txt" caseSensitive="false"/> </file:inbound-endpoint> <scripting:component doc:name="Groovy"> <scripting:script engine="Groovy"> <![CDATA[ sleep(3000); System.out.println("Holding the flow for 3000 ms"); return message.payload;]]> </scripting:script> </scripting:component> <file:outbound-endpoint path="E:backuptestnewfolder" responseTimeout="10000" doc:name="File"/> </flow>
  • 10. So, if we start our application again and put the inbound file in the location E:backuptest , we will get the following in our console :-
  • 11. And we will get the file in our outbound location E:backuptestnewfolder after 3000 ms
  • 12. Hope you enjoyed the simple yet an amazing trick in Mule