SlideShare a Scribd company logo
Groovy with mule
Groovy with 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
Groovy with mule

More Related Content

PPTX
Caching and invalidating with managed store
PPTX
Simple groovy example in mule
PPTX
Compressing & decompressing in mule
PPTX
Groovy example in mule
PPTX
Mulesoft Using Groovy Component
PPTX
Accessing Mule variables in groovy
PPTX
Encrypting/Decrypting mule
PPTX
Process file one after another
Caching and invalidating with managed store
Simple groovy example in mule
Compressing & decompressing in mule
Groovy example in mule
Mulesoft Using Groovy Component
Accessing Mule variables in groovy
Encrypting/Decrypting mule
Process file one after another

What's hot (13)

PPTX
Compress and decompress
PPTX
Groovy in Mule
PPTX
Cache for community edition
PPTX
Caching & validating
PPTX
Timer Interceptor in Mule part 2
PPTX
Quartz component in mule demo
PPTX
Mule esb db_2
PPTX
Mule message enricher
PPTX
Stored procedure in Mule
PPTX
Mule esb db_1
PPTX
Introduction to node.js
PPTX
Mule esb add logger to existing flow
PPTX
Mule esb :Data Weave
Compress and decompress
Groovy in Mule
Cache for community edition
Caching & validating
Timer Interceptor in Mule part 2
Quartz component in mule demo
Mule esb db_2
Mule message enricher
Stored procedure in Mule
Mule esb db_1
Introduction to node.js
Mule esb add logger to existing flow
Mule esb :Data Weave
Ad

Viewers also liked (20)

PPTX
How to write an essay
DOCX
El plan de mercadeo(1) (1)
PPTX
Scatter gather
PPTX
Cache for community edition
PPTX
Vm component
PPTX
Mule with velocity
PPTX
Los modelos teóricos del proceso salud enfermedad
PDF
Los secretos de la mente millonaria t harv eker
PPTX
Mule esb stripe
PPT
Anypoint data gateway
PPTX
Caching and invalidating with managed store
DOCX
Paul Resume 2016
PPTX
Mule for each scope headerc ollection
PDF
jn_fs_tech_insider_march_032516
PPTX
Choice component
PPTX
Validate soap request in mule
PDF
arte urbano
DOCX
PPTX
Mule esb Basics
PPTX
Until successful component
How to write an essay
El plan de mercadeo(1) (1)
Scatter gather
Cache for community edition
Vm component
Mule with velocity
Los modelos teóricos del proceso salud enfermedad
Los secretos de la mente millonaria t harv eker
Mule esb stripe
Anypoint data gateway
Caching and invalidating with managed store
Paul Resume 2016
Mule for each scope headerc ollection
jn_fs_tech_insider_march_032516
Choice component
Validate soap request in mule
arte urbano
Mule esb Basics
Until successful component
Ad

Similar to Groovy with mule (20)

PPTX
Holding a mule flow
PPTX
Simple groovy example in mule
PPTX
Simple groovy example in mule
PPTX
Simple groovy example in mule
PPTX
Simple groovy example in mule
PPTX
Simple groovy example in mule
PPTX
Groovy example in mule
PPTX
Groovy with Mule
PPTX
SmpleGroovyexampleinmule
PPTX
Handle File on mule
PPT
Dance for the puppet master: G6 Tech Talk
PPTX
Ufo Ship for AWS ECS
ODP
Apache Syncope: an Apache Camel Integration Proposal
PDF
Netty - anfix tech&beers
PPTX
Everything you wanted to know about writing async, concurrent http apps in java
PDF
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
PPTX
Adding dynamic file
PPTX
Puppet - an introduction
PDF
Thotcon - All aboard the Fail Whale
PPTX
Getting started with agile database migrations for java flywaydb
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
Groovy example in mule
Groovy with Mule
SmpleGroovyexampleinmule
Handle File on mule
Dance for the puppet master: G6 Tech Talk
Ufo Ship for AWS ECS
Apache Syncope: an Apache Camel Integration Proposal
Netty - anfix tech&beers
Everything you wanted to know about writing async, concurrent http apps in java
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Adding dynamic file
Puppet - an introduction
Thotcon - All aboard the Fail Whale
Getting started with agile database migrations for java flywaydb

More from Sunil Komarapu (20)

PPTX
WebServices
PPT
PPT
Mule esb api layer
PPTX
Mmc rest api user groups
PPTX
Mapping and listing with mule
PPTX
How to use message properties component
PPTX
How to use expression filter
PPTX
Data weave
PPTX
Caching and invalidating with managed store
PPTX
Automatic documantation with mule
PPTX
Converting with custom transformer
PPTX
Creating dynamic json
PPTX
Idempotent filter with simple file
PPTX
PPTX
Jenkins2
PPTX
Jenkins3
PPTX
Maven part 1
PPTX
Maven ii
PPTX
Maven iii
PPTX
Mule esb
WebServices
Mule esb api layer
Mmc rest api user groups
Mapping and listing with mule
How to use message properties component
How to use expression filter
Data weave
Caching and invalidating with managed store
Automatic documantation with mule
Converting with custom transformer
Creating dynamic json
Idempotent filter with simple file
Jenkins2
Jenkins3
Maven part 1
Maven ii
Maven iii
Mule esb

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
1. Introduction to Computer Programming.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Approach and Philosophy of On baking technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Getting Started with Data Integration: FME Form 101
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Machine Learning_overview_presentation.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Unlocking AI with Model Context Protocol (MCP)
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Electronic commerce courselecture one. Pdf
MYSQL Presentation for SQL database connectivity
NewMind AI Weekly Chronicles - August'25-Week II
1. Introduction to Computer Programming.pptx
Machine learning based COVID-19 study performance prediction
Approach and Philosophy of On baking technology
Advanced methodologies resolving dimensionality complications for autism neur...
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Getting Started with Data Integration: FME Form 101
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Machine Learning_overview_presentation.pptx

Groovy with mule

  • 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