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

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

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

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
Michael Peacock
 
Netty - anfix tech&beers
Netty - anfix tech&beersNetty - anfix tech&beers
Netty - anfix tech&beers
jorgecarabias
 

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
 
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
 
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 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 (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

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
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
Earley Information Science
 

Dernier (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
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...
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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
 
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
 

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