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

github.com/tomj74/chunk-templates

Freemarker

camel-freemarker

2.10

freemarker.apache.org

JTE

camel-jte

4.4

jte.gg/

MVEL

camel-mvel

2.12

mvel.documentnode.com

Mustache

camel-mustache

2.12

mustache.github.io

String Template

camel-stringtemplate

1.2

www.stringtemplate.org

Thymeleaf

camel-thymeleaf

4.1

www.thymeleaf.org

Velocity

camel-velocity

1.2

velocity.apache.org

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.