The Parse Template component loads a file into the Mule payload. The ‘Parse Template’ transformer parses a template file that can contain Mule Expression Language and places the resulting string into the message payload. 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.
Parse Template is the Mule component to use for processing a template and obtaining a result. A template is defined as text with embedded Mule expressions that are evaluated and replaced with their result.
General configuration of HTTP Listener
Pass the payload value in Setpayload as a Request:
[
{
"orderNumber": "343543",
"orderStatus": "Active",
"orderDate": "2022-01-01",
"orderDescription": "2 laptop ordered"
},
{
"orderNumber": "343893",
"orderStatus": "Active",
"orderDate": "2022-01-08",
"orderDescription": "2 laptop ordered"
},
{
"orderNumber": "345443",
"orderStatus": "Active",
"orderDate": "2022-01-06",
"orderDescription": "2 laptop ordered"
}
]
Drag a parse template message processor from the palette onto the canvas, then configure the fields according to the table below.
File location: C:\Users\mhsar\OneDrive\Desktop\order.hml.txt
Field | Value | Description |
---|---|---|
Display Name | Parse Template | Customize to display a unique name for the transformer in your application. |
Location | filepath | Define the location of the file that Mule uses as a template into which to insert values extracted from the message properties or variables. |
Add a logger which will print the received payload in Console
URL: http://0.0.0.0:8081/parse Method: POST
Response:
<html>
<table border=2>
<tr>
<th>order Number</th>
<th>order Status</th>
<th>order Date</th>
<th>order Description</th>
</tr>
<tr>
<td>343543</td>
<td>Active</td>
<td>2022-01-01</td>
<td>2 laptop ordered</td>
</tr>
<tr>
<td>343893</td>
<td>Active</td>
<td>2022-01-08</td>
<td>2 laptop ordered</td>
</tr>
<tr>
<td>345443</td>
<td>Active</td>
<td>2022-01-06</td>
<td>2 laptop ordered</td>
</tr>
</table>
<html>
If you like my post please follow me to read my latest post on programming and technology.
Problem Statement: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example…
Given an integer A. Compute and return the square root of A. If A is…
Given a zero-based permutation nums (0-indexed), build an array ans of the same length where…
A heap is a specialized tree-based data structure that satisfies the heap property. It is…
What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of…