SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Velocity in Mule
Have you ever wondered how to send an email through Mule Esb with a well designed format and
where you can pick up some dynamic values from properties file and designed your email from a
pre defined template and design in a colourful format with colourful text and logos ??
Yes you can design that email for your customers, subscribers or anybody else you wish to.
Mule can trigger mail with a pre defined template where you can design the body of your email with
different HTML tags and put various texts, text colour, images, logos in your email body and also pic
some dynamic values in it.
To design the template you only need a minimum knowledge of HTML tags and can design the
template easily.
Yes .. I am talking about Mule with Velocity template for your mail ..
Before we start, we will see what is Velocity template.
Velocity is an open source templating tool developed by an international volunteer community and
hosted by the Apache Software Foundation's Jakarta Project.
You can find more information on it here :- https://velocity.apache.org/engine/releases/velocity-
1.5/user-guide.html#what_is_velocity
To integrate Velocity template with Mule you will find good examples over net.
There is already example by great David Dossot of using Velocity transformer class here :-
https://muleinaction.googlecode.com/svn-history/r490/branches/mule-3/chapter05/velocity-
transformer/src/main/java/com/muleinaction/transformer/MarkingVelocityMessageTransformer.jav
a
I have just modified the code and reused it as per my requirement
So, we first need a Velocity transformer Java class as following :-
This class will set the email payload, map the external dynamic values with the email
So, we will also have external values from properties files as following :-
These values from properties file will make the Velocity template dynamic as it will pick the values form here
and set to the mail body .. Values like customer or subscriber name can be defined here dynamically
So, we will also have external values from properties files as following :-
Here you can see, file is picked up by the flow and the file content is set as message body of the email along with
other dynamic values from external properties file
And finally our Velocity template is as following :-
Here you can see the HTML codes like <p/>, <img/> <html> tags are used to design the email content .. Also, values
like $FileName, $Subscriber are picked from properties file.
Also $payload is the content from the inbound file and it is appended with this mail body.
Isn’t these are dynamic !!!!
Let’s test our application now.. Let’s place a file in the inbound folder with a content say This message is from a
file !!! And start our application … we will see the console as following :-
You can see the email has been send successfully and the email body as a preview in the log ..
Now let’s check our actual email
Here is the mail we received from Mule with Velocity template and here what we got :-
You can see different text formats, bold texts , images , logos etc that was designed in Velocity template with
HTML codes. Also, you can see the values are picked from properties file
So, here you can see how to set a email body colourful and dynamic using Mule and Velocity
template !!!….
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 
Mule with velocity

Weitere ähnliche Inhalte

Was ist angesagt?

Demo on Mule ESB Facebook Connector
Demo on Mule ESB Facebook ConnectorDemo on Mule ESB Facebook Connector
Demo on Mule ESB Facebook ConnectorRupesh Sinha
 
Content based routing tutorial in mule
Content based routing tutorial in muleContent based routing tutorial in mule
Content based routing tutorial in muleSindhu VL
 
Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versionsAnirban Sen Chowdhary
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in MuleKhasim Saheb
 
Integration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESBIntegration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESBRupesh Sinha
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with muleF K
 
Deploying and running mule standalone
Deploying and running mule standaloneDeploying and running mule standalone
Deploying and running mule standalonemdfkhan625
 

Was ist angesagt? (11)

Demo on Mule ESB Facebook Connector
Demo on Mule ESB Facebook ConnectorDemo on Mule ESB Facebook Connector
Demo on Mule ESB Facebook Connector
 
Content based routing tutorial in mule
Content based routing tutorial in muleContent based routing tutorial in mule
Content based routing tutorial in mule
 
Automatic documentation with mule
Automatic documentation with mule Automatic documentation with mule
Automatic documentation with mule
 
Mule data bases
Mule data basesMule data bases
Mule data bases
 
Getting anypoint studios all versions
Getting anypoint studios all versionsGetting anypoint studios all versions
Getting anypoint studios all versions
 
Deploying and Running in Mule
Deploying and Running in MuleDeploying and Running in Mule
Deploying and Running in Mule
 
Data weave in Mule
Data weave in MuleData weave in Mule
Data weave in Mule
 
Integration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESBIntegration with Dropbox using Mule ESB
Integration with Dropbox using Mule ESB
 
Mule
MuleMule
Mule
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with mule
 
Deploying and running mule standalone
Deploying and running mule standaloneDeploying and running mule standalone
Deploying and running mule standalone
 

Andere mochten auch

ASTer - Verifica Monitoraggio EMISSIONI | opus automazione spa
ASTer - Verifica Monitoraggio EMISSIONI | opus automazione spaASTer - Verifica Monitoraggio EMISSIONI | opus automazione spa
ASTer - Verifica Monitoraggio EMISSIONI | opus automazione spaopus automazione spa
 
Efecto multiplicador bancario y encajes
Efecto multiplicador bancario y encajesEfecto multiplicador bancario y encajes
Efecto multiplicador bancario y encajesemmanuelpocovi
 
Autoplay
AutoplayAutoplay
Autoplayvnnpas
 
Exploring Altmetrics with Impactstory
Exploring Altmetrics with ImpactstoryExploring Altmetrics with Impactstory
Exploring Altmetrics with ImpactstoryRichard Stringer-Hye
 
Mule with rabbit mq
Mule with rabbit mqMule with rabbit mq
Mule with rabbit mqHasan Syed
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with muleHasan Syed
 

Andere mochten auch (12)

ASTer - Verifica Monitoraggio EMISSIONI | opus automazione spa
ASTer - Verifica Monitoraggio EMISSIONI | opus automazione spaASTer - Verifica Monitoraggio EMISSIONI | opus automazione spa
ASTer - Verifica Monitoraggio EMISSIONI | opus automazione spa
 
Efecto multiplicador bancario y encajes
Efecto multiplicador bancario y encajesEfecto multiplicador bancario y encajes
Efecto multiplicador bancario y encajes
 
Profile -Harbin Dadi
Profile -Harbin DadiProfile -Harbin Dadi
Profile -Harbin Dadi
 
Cleaning Resume 2403
Cleaning Resume 2403Cleaning Resume 2403
Cleaning Resume 2403
 
Autoplay
AutoplayAutoplay
Autoplay
 
NARESH 3+
NARESH 3+NARESH 3+
NARESH 3+
 
Exploring Altmetrics with Impactstory
Exploring Altmetrics with ImpactstoryExploring Altmetrics with Impactstory
Exploring Altmetrics with Impactstory
 
KIR February Progress Report
KIR February Progress ReportKIR February Progress Report
KIR February Progress Report
 
Maven part 1
Maven part 1Maven part 1
Maven part 1
 
Jenkins2
Jenkins2Jenkins2
Jenkins2
 
Mule with rabbit mq
Mule with rabbit mqMule with rabbit mq
Mule with rabbit mq
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with mule
 

Ähnlich wie Mule with velocity

Email configuration in mule esb
Email configuration in mule esbEmail configuration in mule esb
Email configuration in mule esbVamsi Krishna
 
What is html xml and xhtml
What is html xml and xhtmlWhat is html xml and xhtml
What is html xml and xhtmlFkdiMl
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule AbdulImrankhan7
 
Automatic documentation with mule
Automatic documentation with mule Automatic documentation with mule
Automatic documentation with mule javeed_mhd
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule mdfkhan625
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with muleMohammed246
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule Khasim Saheb
 
Automatic documantation with mule
Automatic documantation with muleAutomatic documantation with mule
Automatic documantation with muleSunil Komarapu
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esbAnand kalla
 
Emberjs and ASP.NET
Emberjs and ASP.NETEmberjs and ASP.NET
Emberjs and ASP.NETMike Melusky
 
Mulesoft - Documentation (Automation)
Mulesoft - Documentation (Automation)Mulesoft - Documentation (Automation)
Mulesoft - Documentation (Automation)Vamsi Krishna
 
Mule connectors-part 1
Mule connectors-part 1Mule connectors-part 1
Mule connectors-part 1VirtusaPolaris
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSreekanth Kondapalli
 

Ähnlich wie Mule with velocity (20)

Dynamic file attribute
Dynamic file attributeDynamic file attribute
Dynamic file attribute
 
Email configuration in mule esb
Email configuration in mule esbEmail configuration in mule esb
Email configuration in mule esb
 
What is html xml and xhtml
What is html xml and xhtmlWhat is html xml and xhtml
What is html xml and xhtml
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule
 
Automatic documentation with mule
Automatic documentation with mule Automatic documentation with mule
Automatic documentation with mule
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule
 
Documantation with mule
Documantation with mule Documantation with mule
Documantation with mule
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with mule
 
Automatic documantation with mule
Automatic documantation with mule Automatic documantation with mule
Automatic documantation with mule
 
Automatic documantation with mule
Automatic documantation with muleAutomatic documantation with mule
Automatic documantation with mule
 
Joomla tempates talk
Joomla tempates talkJoomla tempates talk
Joomla tempates talk
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
 
Presentation 1 [autosaved]
Presentation 1 [autosaved]Presentation 1 [autosaved]
Presentation 1 [autosaved]
 
Trigger Emails BigD17
Trigger Emails BigD17Trigger Emails BigD17
Trigger Emails BigD17
 
Send email attachment using smtp in mule esb
Send email attachment using smtp  in mule esbSend email attachment using smtp  in mule esb
Send email attachment using smtp in mule esb
 
Emberjs and ASP.NET
Emberjs and ASP.NETEmberjs and ASP.NET
Emberjs and ASP.NET
 
Mulesoft - Documentation (Automation)
Mulesoft - Documentation (Automation)Mulesoft - Documentation (Automation)
Mulesoft - Documentation (Automation)
 
Mule connectors-part 1
Mule connectors-part 1Mule connectors-part 1
Mule connectors-part 1
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
 
Xml transform
Xml transformXml transform
Xml transform
 

Mehr von Hasan Syed

Web service vm in mule
Web service vm in muleWeb service vm in mule
Web service vm in muleHasan Syed
 
Validate soap request in mule
Validate soap request in muleValidate soap request in mule
Validate soap request in muleHasan Syed
 
Simple web service vm
Simple web service vmSimple web service vm
Simple web service vmHasan Syed
 
Scatter gather flow control
Scatter gather flow controlScatter gather flow control
Scatter gather flow controlHasan Syed
 
Mule with quartz
Mule with quartzMule with quartz
Mule with quartzHasan Syed
 
Mule with drools
Mule with droolsMule with drools
Mule with droolsHasan Syed
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple fileHasan Syed
 
Groovy with mule
Groovy with muleGroovy with mule
Groovy with muleHasan Syed
 
Creating dynamic json
Creating dynamic jsonCreating dynamic json
Creating dynamic jsonHasan Syed
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformerHasan Syed
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed storeHasan Syed
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community editionHasan Syed
 

Mehr von Hasan Syed (18)

Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Web service vm in mule
Web service vm in muleWeb service vm in mule
Web service vm in mule
 
Validate soap request in mule
Validate soap request in muleValidate soap request in mule
Validate soap request in mule
 
Simple web service vm
Simple web service vmSimple web service vm
Simple web service vm
 
Scatter gather flow control
Scatter gather flow controlScatter gather flow control
Scatter gather flow control
 
Mule with quartz
Mule with quartzMule with quartz
Mule with quartz
 
Mule with drools
Mule with droolsMule with drools
Mule with drools
 
Mule esb
Mule esbMule esb
Mule esb
 
Maven iii
Maven iiiMaven iii
Maven iii
 
Maven ii
Maven iiMaven ii
Maven ii
 
Jenkins3
Jenkins3Jenkins3
Jenkins3
 
Jenkins
JenkinsJenkins
Jenkins
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple file
 
Groovy with mule
Groovy with muleGroovy with mule
Groovy with mule
 
Creating dynamic json
Creating dynamic jsonCreating dynamic json
Creating dynamic json
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformer
 
Caching and invalidating with managed store
Caching and invalidating with managed storeCaching and invalidating with managed store
Caching and invalidating with managed store
 
Cache for community edition
Cache for community editionCache for community edition
Cache for community edition
 

Kürzlich hochgeladen

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 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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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 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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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...apidays
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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 SolutionsEnterprise Knowledge
 
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 MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 

Kürzlich hochgeladen (20)

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 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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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 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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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...
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 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
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Mule with velocity

  • 2. Have you ever wondered how to send an email through Mule Esb with a well designed format and where you can pick up some dynamic values from properties file and designed your email from a pre defined template and design in a colourful format with colourful text and logos ?? Yes you can design that email for your customers, subscribers or anybody else you wish to. Mule can trigger mail with a pre defined template where you can design the body of your email with different HTML tags and put various texts, text colour, images, logos in your email body and also pic some dynamic values in it. To design the template you only need a minimum knowledge of HTML tags and can design the template easily. Yes .. I am talking about Mule with Velocity template for your mail ..
  • 3.
  • 4. Before we start, we will see what is Velocity template. Velocity is an open source templating tool developed by an international volunteer community and hosted by the Apache Software Foundation's Jakarta Project. You can find more information on it here :- https://velocity.apache.org/engine/releases/velocity- 1.5/user-guide.html#what_is_velocity To integrate Velocity template with Mule you will find good examples over net. There is already example by great David Dossot of using Velocity transformer class here :- https://muleinaction.googlecode.com/svn-history/r490/branches/mule-3/chapter05/velocity- transformer/src/main/java/com/muleinaction/transformer/MarkingVelocityMessageTransformer.jav a I have just modified the code and reused it as per my requirement
  • 5. So, we first need a Velocity transformer Java class as following :- This class will set the email payload, map the external dynamic values with the email
  • 6. So, we will also have external values from properties files as following :- These values from properties file will make the Velocity template dynamic as it will pick the values form here and set to the mail body .. Values like customer or subscriber name can be defined here dynamically
  • 7. So, we will also have external values from properties files as following :- Here you can see, file is picked up by the flow and the file content is set as message body of the email along with other dynamic values from external properties file
  • 8. And finally our Velocity template is as following :- Here you can see the HTML codes like <p/>, <img/> <html> tags are used to design the email content .. Also, values like $FileName, $Subscriber are picked from properties file. Also $payload is the content from the inbound file and it is appended with this mail body. Isn’t these are dynamic !!!!
  • 9. Let’s test our application now.. Let’s place a file in the inbound folder with a content say This message is from a file !!! And start our application … we will see the console as following :- You can see the email has been send successfully and the email body as a preview in the log .. Now let’s check our actual email
  • 10. Here is the mail we received from Mule with Velocity template and here what we got :- You can see different text formats, bold texts , images , logos etc that was designed in Velocity template with HTML codes. Also, you can see the values are picked from properties file
  • 11. So, here you can see how to set a email body colourful and dynamic using Mule and Velocity template !!!….
  • 12. 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 