SlideShare a Scribd company logo
Using Parse Template
Component
- By Rahul Kumar
Parse Template Component
Use a parse template to load the content of a flow-external file into a Mule flow,
then use the file as a template into which you can insert data returned as the
result of evaluated Mule expressions.
Groovy also allows the developer to configure interceptors and alter the values
or references of particular properties in a script. Interceptors are configured to
provide additional services to a message as it flows through a component
Parse Template Component
For example, perhaps you want a Mule flow to send an "order complete" HTTP response to a
caller to indicate the new order’s number and the number of widgets ordered (both values that
you previously set on the Mule message as variables). You can use a parse template to load a
file from an external location – a file which, behaving as a template, expects values for "order
number" and "number of widgets". Then, the parse template extracts info from the Mule
message variables to insert as values into the template and set the resulting contents as the
message payload. In essence, a parse template pulls a template file into a Mule flow, fills in the
blanks, then sets results on the message as the payload. In the example, after the parse
template sets the payload on the message using the external file as a template, the Mule flow
returns the HTTP response to confirm the order
Configuratio :
Location : Define the location of the file that Mule uses as a template into
which to insert values extracted from the message properties or variables.
Examples
<html>
<body>
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Department</th>
<th>Job Title</th>
<th>Start Date</th>
<th>Employee Type</th>
</tr>
<tr>
<td>#[payload[0]['first_name']]</td>
<td>#[payload[0]['last_name']]</td>
<td>#[payload[0]['department']]</td>
<td>#[payload[0]['job_title']]</td>
<td>#[payload[0]['start_date']]</td>
<td>#[payload[0]['employee_type']]</td>
Examples
<flow name="exampleTemplateFlow1" >
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"
doc:description="Send GET request with a parameter, for example,
http://localhost:8081/getEmployee?id=12345"/>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response"
queryKey="getEmployeeById" queryTimeout="-1" connector-ref="Database"
doc:name="Database" doc:description="Returns list of maps containing records; only the first
one is required."/>
<parse-template location="src/test/resources/responseHtml.template" doc:name="Parse
Template"/>
<set-property doc:name="Content Type" propertyName="Content-Type" value="text/html"/>
</flow>
Examples
To use the application in this example, you must send an HTTP request with a URL that
includes an id query parameter, such as http://localhost:8081/getEmployee?id=12345.
Dynamic HTML is returned according to the Mule expressions in the template
Thank You !!

More Related Content

What's hot (17)

PPTX
Mule Esb Data Weave
Mohammed246
 
PPTX
Mule esb :Data Weave
AnilKumar Etagowni
 
PPTX
For each component in mule
Rajkattamuri
 
PPT
Mule introduction
Satya Sekhar Das Mandal
 
PPTX
Using XSLT in Mule
Anirban Sen Chowdhary
 
PPTX
Mule esb
Khan625
 
PPTX
Mule accessing multiple database in parallel
Anirban Sen Chowdhary
 
PPTX
Expression filter in Mule
Mohammed246
 
PPTX
Until successful component in mule
javeed_mhd
 
PPTX
Mule property placeholder
Sashidhar Rao GDS
 
PDF
Connecting To MS SQL Server With Mulesoft (Stored Procedure To Insert data)
Jitendra Bafna
 
PPTX
Expression filter in Mule
Khan625
 
PPTX
xslt in mule
Praneethchampion
 
PDF
MuleSoft ESB Message Enricher
akashdprajapati
 
PPTX
File component in mule
Rajkattamuri
 
PPTX
Parameters as a part of body
Anirban Sen Chowdhary
 
PPTX
Xslt with mule
Son Nguyen
 
Mule Esb Data Weave
Mohammed246
 
Mule esb :Data Weave
AnilKumar Etagowni
 
For each component in mule
Rajkattamuri
 
Mule introduction
Satya Sekhar Das Mandal
 
Using XSLT in Mule
Anirban Sen Chowdhary
 
Mule esb
Khan625
 
Mule accessing multiple database in parallel
Anirban Sen Chowdhary
 
Expression filter in Mule
Mohammed246
 
Until successful component in mule
javeed_mhd
 
Mule property placeholder
Sashidhar Rao GDS
 
Connecting To MS SQL Server With Mulesoft (Stored Procedure To Insert data)
Jitendra Bafna
 
Expression filter in Mule
Khan625
 
xslt in mule
Praneethchampion
 
MuleSoft ESB Message Enricher
akashdprajapati
 
File component in mule
Rajkattamuri
 
Parameters as a part of body
Anirban Sen Chowdhary
 
Xslt with mule
Son Nguyen
 

Similar to Using parse template component (20)

PPTX
Parse template transformer mule
Ankit Lawaniya
 
PPTX
Mule connectors-session1
Vishnukanth Rachineni
 
PPTX
Mule connectors-part 1
VirtusaPolaris
 
PPTX
Mule ESB Components
pat_91
 
PPTX
Elements in a muleflow
Thang Loi
 
PPTX
Mule concepts
Sindhu VL
 
PPTX
Elements in a mule flow
Sindhu VL
 
PPTX
Mule esb
vishnukanthro45
 
PPTX
Mule esb
charan teja R
 
PPTX
Maven tools & archetypes
Son Nguyen
 
PPTX
Mule advanced
D.Rajesh Kumar
 
PDF
WEB DESIGNING.pdf
Prof. Dr. K. Adisesha
 
PDF
Web designing
Prof. Dr. K. Adisesha
 
PPTX
HTML/HTML5
People Strategists
 
PDF
HTML Foundations, pt 2
Shawn Calvert
 
PPT
331592291-HTML-and-Cascading style sheet
stephen972973
 
PDF
Mule ESB Interview or Certification questions
TechieVarsity
 
PDF
Mule ESB
Yura Nosenko
 
PPTX
Data weave
Khasim Saheb
 
Parse template transformer mule
Ankit Lawaniya
 
Mule connectors-session1
Vishnukanth Rachineni
 
Mule connectors-part 1
VirtusaPolaris
 
Mule ESB Components
pat_91
 
Elements in a muleflow
Thang Loi
 
Mule concepts
Sindhu VL
 
Elements in a mule flow
Sindhu VL
 
Mule esb
vishnukanthro45
 
Mule esb
charan teja R
 
Maven tools & archetypes
Son Nguyen
 
Mule advanced
D.Rajesh Kumar
 
WEB DESIGNING.pdf
Prof. Dr. K. Adisesha
 
Web designing
Prof. Dr. K. Adisesha
 
HTML/HTML5
People Strategists
 
HTML Foundations, pt 2
Shawn Calvert
 
331592291-HTML-and-Cascading style sheet
stephen972973
 
Mule ESB Interview or Certification questions
TechieVarsity
 
Mule ESB
Yura Nosenko
 
Data weave
Khasim Saheb
 
Ad

More from Rahul Kumar (20)

PPTX
Combine collections transformer
Rahul Kumar
 
PPTX
Creating global functions
Rahul Kumar
 
PPTX
Creating custom object store
Rahul Kumar
 
PPTX
Using expression component
Rahul Kumar
 
PPTX
Creating custom transformer
Rahul Kumar
 
PPTX
Creating custom aggregation strategy
Rahul Kumar
 
PPTX
Creating custom aggregator
Rahul Kumar
 
PPTX
Byte array to hex string transformer
Rahul Kumar
 
PPTX
Creating custom filter
Rahul Kumar
 
PPTX
Hex string to byte array transformer
Rahul Kumar
 
PPTX
XML to DOM Transformer
Rahul Kumar
 
PPTX
Dom to xml transformer
Rahul Kumar
 
PPTX
Object to input stream transformer
Rahul Kumar
 
PPTX
Byte array to object transformer
Rahul Kumar
 
PPTX
Byte array to string transformer
Rahul Kumar
 
PPTX
Object to string transformer
Rahul Kumar
 
PPTX
Csv to json transform in simple steps
Rahul Kumar
 
PPTX
Using scatter gather
Rahul Kumar
 
PPTX
Choice router
Rahul Kumar
 
PPTX
Using idempotent filter
Rahul Kumar
 
Combine collections transformer
Rahul Kumar
 
Creating global functions
Rahul Kumar
 
Creating custom object store
Rahul Kumar
 
Using expression component
Rahul Kumar
 
Creating custom transformer
Rahul Kumar
 
Creating custom aggregation strategy
Rahul Kumar
 
Creating custom aggregator
Rahul Kumar
 
Byte array to hex string transformer
Rahul Kumar
 
Creating custom filter
Rahul Kumar
 
Hex string to byte array transformer
Rahul Kumar
 
XML to DOM Transformer
Rahul Kumar
 
Dom to xml transformer
Rahul Kumar
 
Object to input stream transformer
Rahul Kumar
 
Byte array to object transformer
Rahul Kumar
 
Byte array to string transformer
Rahul Kumar
 
Object to string transformer
Rahul Kumar
 
Csv to json transform in simple steps
Rahul Kumar
 
Using scatter gather
Rahul Kumar
 
Choice router
Rahul Kumar
 
Using idempotent filter
Rahul Kumar
 
Ad

Recently uploaded (20)

PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PPTX
How Odoo Became a Game-Changer for an IT Company in Manufacturing ERP
SatishKumar2651
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PDF
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Import Data Form Excel to Tally Services
Tally xperts
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
How Odoo Became a Game-Changer for an IT Company in Manufacturing ERP
SatishKumar2651
 
Tally software_Introduction_Presentation
AditiBansal54083
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 

Using parse template component

  • 2. Parse Template Component Use a parse template to load the content of a flow-external file into a Mule flow, then use the file as a template into which you can insert data returned as the result of evaluated Mule expressions. Groovy also allows the developer to configure interceptors and alter the values or references of particular properties in a script. Interceptors are configured to provide additional services to a message as it flows through a component
  • 3. Parse Template Component For example, perhaps you want a Mule flow to send an "order complete" HTTP response to a caller to indicate the new order’s number and the number of widgets ordered (both values that you previously set on the Mule message as variables). You can use a parse template to load a file from an external location – a file which, behaving as a template, expects values for "order number" and "number of widgets". Then, the parse template extracts info from the Mule message variables to insert as values into the template and set the resulting contents as the message payload. In essence, a parse template pulls a template file into a Mule flow, fills in the blanks, then sets results on the message as the payload. In the example, after the parse template sets the payload on the message using the external file as a template, the Mule flow returns the HTTP response to confirm the order
  • 4. Configuratio : Location : Define the location of the file that Mule uses as a template into which to insert values extracted from the message properties or variables.
  • 5. Examples <html> <body> <table> <tr> <th>First Name</th> <th>Last Name</th> <th>Department</th> <th>Job Title</th> <th>Start Date</th> <th>Employee Type</th> </tr> <tr> <td>#[payload[0]['first_name']]</td> <td>#[payload[0]['last_name']]</td> <td>#[payload[0]['department']]</td> <td>#[payload[0]['job_title']]</td> <td>#[payload[0]['start_date']]</td> <td>#[payload[0]['employee_type']]</td>
  • 6. Examples <flow name="exampleTemplateFlow1" > <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP" doc:description="Send GET request with a parameter, for example, http://localhost:8081/getEmployee?id=12345"/> <jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="getEmployeeById" queryTimeout="-1" connector-ref="Database" doc:name="Database" doc:description="Returns list of maps containing records; only the first one is required."/> <parse-template location="src/test/resources/responseHtml.template" doc:name="Parse Template"/> <set-property doc:name="Content Type" propertyName="Content-Type" value="text/html"/> </flow>
  • 7. Examples To use the application in this example, you must send an HTTP request with a URL that includes an id query parameter, such as http://localhost:8081/getEmployee?id=12345. Dynamic HTML is returned according to the Mule expressions in the template