Template engines
A template engine is a tool that generates text output, such as emails, XML, JSon or code, by combining templates with dynamic data. In Camel, templates are primarily used to create layouts while dynamically using data from the current Message Exchange.
Below is a list of some of the template engines that are provided by Camel:
| Template | Artifact | Description |
|---|---|---|
camel-chunk | Transform messages using Chunk templating engine. | |
camel-freemarker | Transform messages using FreeMarker templates. | |
camel-jte | Transform messages using a Java based template engine (JTE). | |
camel-mustache | Transform messages using a Mustache template. | |
camel-mvel | Transform messages using an MVEL template. | |
camel-stringtemplate | Transform messages using StringTemplate engine. | |
camel-thymeleaf | Transform messages using a Thymeleaf template. | |
camel-velocity | Transform messages using a Velocity template. | |
camel-xslt | Transforms XML payload using an XSLT template. | |
camel-xslt-saxon | Transform XML payloads using an XSLT template using Saxon. |
To see a wider list try Camel JBang to execute: camel catalog component --filter=transform from the CLI. |
Which template engine to choose
Velocity is a mature template engine with long-term support from Camel. It can be used for text generation, such as emails. Mustache can be used for similar purposes and is cross-platform.
For templates that require more conditional logic and XML or HTML output, Freemarker, MVEL, and Thymeleaf are good choices. JTE is known to be fast due to its compile-time template processing.
| These template engines perform directly on the Exchange, if you want to template routes, look at Route Templates. |