Template engines
A template engine is a tool that generates text output, such as emails, XML, or code, by combining templates with dynamic data. In Apache Camel, templates are primarily used to create layouts while dynamically using exchange data.
Below is a list of the template engines that are provided by Apache Camel.
Template engine | Artifact | Since | Website |
---|---|---|---|
Chunk | camel-chunk | 2.10 | |
Freemarker | camel-freemarker | 2.10 | |
JTE | camel-jte | 4.4 | |
MVEL | camel-mvel | 2.12 | |
Mustache | camel-mustache | 2.12 | |
String Template | camel-stringtemplate | 1.2 | |
Thymeleaf | camel-thymeleaf | 4.1 | |
Velocity | camel-velocity | 1.2 |
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. |