Author: Abhinav Patel
Welcome all, to the series of the HTML rendering in Mule. With this series, I am introducing you all to a whole new world of services that could be created using MuleSoft tools.
If you have not gone through the previous blog, I would recommend you go through it first, to get a basic understanding of HTML rendering and its requirements. In this article, we will try to understand the working of Parse Template for multiple records.
Just to enhance the experience, I have included the concept of sending an email, which we might discuss some other day.
The scenario that we would be looking for is the most common use case in any organisation. Once the recruitment drive is completed the list of selected participants will be maintained in an excel file/CSV file or any database. Later the information will be provided to the concerned team for further processing and even the candidate over mail. We will try to format this data using HTML.
We will be developing an application as shown below to provide a solution for above-mentioned requirements.
I have made use of a scheduler with poll frequency 1 minute so as to keep an eye on the CSV file. Once the validation is done if any new record is found, the details will be sent over mail in a tabular manner. If no new record is found it will simply log this. So as to store the details of the last employee id, I have made use of object-store.
All of the configurations done so as to achieve this are shown below (the rest of values are set to default):
Also, I am saving the output in a variable “lastEmployeeID” as shown below:
- Parse Template: For this blog, we will be making use of Content instead of Location (as done in the previous blog). The body of your HTML response is shown below:
- Create an SMTP connector with the configuration shown below.
- The user and password provided here is the one that will be created as a developer in for mail application.
Also in the Advanced tab create a new property
- Also, provide the settings as shown below:
I hope you got to learn something new from this walk through. Do post your responses as a comment to let me know that your application is running.
Also, if you want to display multiple lines in the same table, we can again make use of dataweave map operation to get it done. Just give this a try and you can cross-check the solution in my upcoming blog.
In the next blog, I will be retrieving the data from the HTML response message. Till then continue reading the other blogs that I have written and do let me know your thoughts on them.