SlideShare une entreprise Scribd logo
1  sur  13
.
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
Groovy example in mule

Contenu connexe

Tendances

Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeirfan1008
 
Mule esb add logger to existing flow
Mule esb add logger to existing flowMule esb add logger to existing flow
Mule esb add logger to existing flowGermano Barba
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo javeed_mhd
 
For each component in mule
For each component in muleFor each component in mule
For each component in muleRajkattamuri
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure in MuleKhasim Saheb
 
Caching & validating
Caching & validatingCaching & validating
Caching & validatingSon Nguyen
 
MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher akashdprajapati
 
Mule ESB SMTP Connector Integration
Mule ESB SMTP Connector  IntegrationMule ESB SMTP Connector  Integration
Mule ESB SMTP Connector IntegrationAnilKumar Etagowni
 
Mule esb
Mule esbMule esb
Mule esbKhan625
 
Message properties component in Mule
Message properties component in MuleMessage properties component in Mule
Message properties component in MuleKhan625
 

Tendances (14)

Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Mule esb add logger to existing flow
Mule esb add logger to existing flowMule esb add logger to existing flow
Mule esb add logger to existing flow
 
Compressing & decompressing in mule
Compressing & decompressing in muleCompressing & decompressing in mule
Compressing & decompressing in mule
 
Mule jdbc
Mule   jdbcMule   jdbc
Mule jdbc
 
Junit in mule demo
Junit in mule demo Junit in mule demo
Junit in mule demo
 
For each component in mule
For each component in muleFor each component in mule
For each component in mule
 
Stored procedure in Mule
Stored procedure in MuleStored procedure in Mule
Stored procedure in Mule
 
Caching & validating
Caching & validatingCaching & validating
Caching & validating
 
MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher MuleSoft ESB Message Enricher
MuleSoft ESB Message Enricher
 
Accessing Mule variables in groovy
Accessing Mule variables in groovyAccessing Mule variables in groovy
Accessing Mule variables in groovy
 
Mule ESB SMTP Connector Integration
Mule ESB SMTP Connector  IntegrationMule ESB SMTP Connector  Integration
Mule ESB SMTP Connector Integration
 
Groovy in Mule
Groovy in MuleGroovy in Mule
Groovy in Mule
 
Mule esb
Mule esbMule esb
Mule esb
 
Message properties component in Mule
Message properties component in MuleMessage properties component in Mule
Message properties component in Mule
 

En vedette

DFSO TERCER PARCIAL 3D
DFSO TERCER PARCIAL 3DDFSO TERCER PARCIAL 3D
DFSO TERCER PARCIAL 3DDulce Estrella
 
Maven tools & archetypes
Maven tools & archetypesMaven tools & archetypes
Maven tools & archetypesSon Nguyen
 
Une Spain Latam les desea Felices Fiestas
Une Spain Latam les desea Felices FiestasUne Spain Latam les desea Felices Fiestas
Une Spain Latam les desea Felices FiestasDavid Cánovas
 
Taller Comparativo y Diseño de una Política de Seguridad de la Información
Taller Comparativo y Diseño de una Política de Seguridad de la InformaciónTaller Comparativo y Diseño de una Política de Seguridad de la Información
Taller Comparativo y Diseño de una Política de Seguridad de la InformaciónDavid Eliseo Martinez Castellanos
 
Informe Clima de Negocios LATAM 2015
Informe Clima de Negocios LATAM 2015Informe Clima de Negocios LATAM 2015
Informe Clima de Negocios LATAM 2015David Cánovas
 
Funções do 1º e 2º grau
Funções do 1º e 2º grauFunções do 1º e 2º grau
Funções do 1º e 2º grauZaqueu Oliveira
 
今からでも大丈夫!Firebase入門
今からでも大丈夫!Firebase入門今からでも大丈夫!Firebase入門
今からでも大丈夫!Firebase入門Tomoki Koga
 
Natural Language Processing: L02 words
Natural Language Processing: L02 wordsNatural Language Processing: L02 words
Natural Language Processing: L02 wordsananth
 

En vedette (13)

DFSO TERCER PARCIAL 3D
DFSO TERCER PARCIAL 3DDFSO TERCER PARCIAL 3D
DFSO TERCER PARCIAL 3D
 
Brayan
BrayanBrayan
Brayan
 
Boletín de novidades. Sección adultos. Novembro-decembro 2016
Boletín de novidades. Sección adultos. Novembro-decembro 2016Boletín de novidades. Sección adultos. Novembro-decembro 2016
Boletín de novidades. Sección adultos. Novembro-decembro 2016
 
Wood_Design_Details (1)
Wood_Design_Details (1)Wood_Design_Details (1)
Wood_Design_Details (1)
 
Rest fullservices
Rest fullservicesRest fullservices
Rest fullservices
 
Senior Project
Senior ProjectSenior Project
Senior Project
 
Maven tools & archetypes
Maven tools & archetypesMaven tools & archetypes
Maven tools & archetypes
 
Une Spain Latam les desea Felices Fiestas
Une Spain Latam les desea Felices FiestasUne Spain Latam les desea Felices Fiestas
Une Spain Latam les desea Felices Fiestas
 
Taller Comparativo y Diseño de una Política de Seguridad de la Información
Taller Comparativo y Diseño de una Política de Seguridad de la InformaciónTaller Comparativo y Diseño de una Política de Seguridad de la Información
Taller Comparativo y Diseño de una Política de Seguridad de la Información
 
Informe Clima de Negocios LATAM 2015
Informe Clima de Negocios LATAM 2015Informe Clima de Negocios LATAM 2015
Informe Clima de Negocios LATAM 2015
 
Funções do 1º e 2º grau
Funções do 1º e 2º grauFunções do 1º e 2º grau
Funções do 1º e 2º grau
 
今からでも大丈夫!Firebase入門
今からでも大丈夫!Firebase入門今からでも大丈夫!Firebase入門
今からでも大丈夫!Firebase入門
 
Natural Language Processing: L02 words
Natural Language Processing: L02 wordsNatural Language Processing: L02 words
Natural Language Processing: L02 words
 

Similaire à Groovy example in mule

Simple groovy example in mule
Simple groovy example in mule Simple groovy example in mule
Simple groovy example in mule Rajkattamuri
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in mulejaveed_mhd
 
Simple groovy example in mule
Simple groovy example in mule Simple groovy example in mule
Simple groovy example in mule Mohammed625
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in muleKhan625
 
Groovy example in mule
Groovy example in mule Groovy example in mule
Groovy example in mule mdfkhan625
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in muleAbdulImrankhan7
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Muleirfan1008
 
Handle File on mule
Handle File on muleHandle File on mule
Handle File on muleSon Nguyen
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkMichael Peacock
 
Ufo Ship for AWS ECS
Ufo Ship for AWS ECSUfo Ship for AWS ECS
Ufo Ship for AWS ECSTung Nguyen
 
Apache Syncope: an Apache Camel Integration Proposal
Apache Syncope: an Apache Camel Integration ProposalApache Syncope: an Apache Camel Integration Proposal
Apache Syncope: an Apache Camel Integration ProposalGiacomo Lamonaco
 
Netty - anfix tech&beers
Netty - anfix tech&beersNetty - anfix tech&beers
Netty - anfix tech&beersjorgecarabias
 
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Baruch Sadogursky
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Ondřej Machulda
 
Adding dynamic file
Adding dynamic fileAdding dynamic file
Adding dynamic fileSon Nguyen
 
Thotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail WhaleThotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail WhaleErin Willingham
 

Similaire à Groovy example in mule (20)

Holding a mule flow
Holding a mule flowHolding a mule flow
Holding a mule flow
 
Simple groovy example in mule
Simple groovy example in mule Simple groovy example in mule
Simple groovy example in mule
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in mule
 
Simple groovy example in mule
Simple groovy example in mule Simple groovy example in mule
Simple groovy example in mule
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in mule
 
Groovy example in mule
Groovy example in mule Groovy example in mule
Groovy example in mule
 
Simple groovy example in mule
Simple groovy example in muleSimple groovy example in mule
Simple groovy example in mule
 
Groovy with Mule
Groovy with MuleGroovy with Mule
Groovy with Mule
 
SmpleGroovyexampleinmule
SmpleGroovyexampleinmuleSmpleGroovyexampleinmule
SmpleGroovyexampleinmule
 
Handle File on mule
Handle File on muleHandle File on mule
Handle File on mule
 
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech TalkDance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
 
Ufo Ship for AWS ECS
Ufo Ship for AWS ECSUfo Ship for AWS ECS
Ufo Ship for AWS ECS
 
Apache Syncope: an Apache Camel Integration Proposal
Apache Syncope: an Apache Camel Integration ProposalApache Syncope: an Apache Camel Integration Proposal
Apache Syncope: an Apache Camel Integration Proposal
 
Netty - anfix tech&beers
Netty - anfix tech&beersNetty - anfix tech&beers
Netty - anfix tech&beers
 
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 
Adding dynamic file
Adding dynamic fileAdding dynamic file
Adding dynamic file
 
Puppet - an introduction
Puppet - an introductionPuppet - an introduction
Puppet - an introduction
 
Thotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail WhaleThotcon - All aboard the Fail Whale
Thotcon - All aboard the Fail Whale
 
Process file one after another
Process file one after anotherProcess file one after another
Process file one after another
 

Plus de Mohammed246

Expression filter in Mule
Expression filter in MuleExpression filter in Mule
Expression filter in MuleMohammed246
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gatewayMohammed246
 
Oracle connector
Oracle connectorOracle connector
Oracle connectorMohammed246
 
Java for beginners
Java for beginnersJava for beginners
Java for beginnersMohammed246
 
Velocity in Mule
Velocity in MuleVelocity in Mule
Velocity in MuleMohammed246
 
Rabbit Mq in Mule
Rabbit Mq in MuleRabbit Mq in Mule
Rabbit Mq in MuleMohammed246
 
Simple web service vm
Simple web service vmSimple web service vm
Simple web service vmMohammed246
 
Validate soap request in mule
Validate soap request in muleValidate soap request in mule
Validate soap request in muleMohammed246
 
Web service vm in mule
Web service vm in muleWeb service vm in mule
Web service vm in muleMohammed246
 

Plus de Mohammed246 (20)

Expression filter in Mule
Expression filter in MuleExpression filter in Mule
Expression filter in Mule
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
Oracle connector
Oracle connectorOracle connector
Oracle connector
 
Api Layer
Api LayerApi Layer
Api Layer
 
Maven part 3
Maven part 3Maven part 3
Maven part 3
 
Maven part 2
Maven part 2Maven part 2
Maven part 2
 
Maven part 1
Maven part 1Maven part 1
Maven part 1
 
Jenkins part 3
Jenkins part 3Jenkins part 3
Jenkins part 3
 
Jenkins part 2
Jenkins part 2Jenkins part 2
Jenkins part 2
 
Jenkins Part 1
Jenkins Part 1Jenkins Part 1
Jenkins Part 1
 
jBPM Connector
jBPM ConnectorjBPM Connector
jBPM Connector
 
Java for beginners
Java for beginnersJava for beginners
Java for beginners
 
Scatter gather
Scatter gather Scatter gather
Scatter gather
 
Velocity in Mule
Velocity in MuleVelocity in Mule
Velocity in Mule
 
Rabbit Mq in Mule
Rabbit Mq in MuleRabbit Mq in Mule
Rabbit Mq in Mule
 
Quartz in Mule
Quartz in MuleQuartz in Mule
Quartz in Mule
 
Simple web service vm
Simple web service vmSimple web service vm
Simple web service vm
 
Validate soap request in mule
Validate soap request in muleValidate soap request in mule
Validate soap request in mule
 
Web service vm in mule
Web service vm in muleWeb service vm in mule
Web service vm in mule
 
Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 

Dernier

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
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
 
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
 
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 WorkerThousandEyes
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
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
 
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
 

Dernier (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 
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
 
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
 

Groovy example in mule

  • 1.
  • 2.
  • 3. .
  • 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