This is a simple guide to using the transformer in Mule ESB to create static content/templates with the option of adding dynamic content. More information about this topic can be found here.How do I use this transformer?
It's fairly straightforward. Use the tag shown below to point to your template, and what the transformer does is basically set the payload to the result of your template being parsed.
<parse-template location="src/test/resources/emailTemplate.txt" doc:name="Parse Template"/>What does a template look like?
For a template used for sending an email, it could look something like this:
Hello #[payload.name], You have just submitted file: #[payload.fileName]. Have a great day.
For a template used for returning some HTML content, it could look something like this:
<html> <body> <h3>You just submitted a file (#[payload.fileName]) on behalf of:</h3> Name: #[payload.firstName], Last Name: #[payload.lastName] </body> </html>