We integrated this template engines as JSR 223 compatible scripting engines. Therefore we create small wrappers for these template engines in our camunda-template-engines-jsr223 project. This has the advantage that we do not need new extension elements or attributes for the BPMN xml. Instead a template can be used everywhere a script can be used. This is especially useful for script tasks and input output mappings. If the template engine JSR 223 wrapper is part of your classpath you can use the name of the template engine as script language.
The maven coordinates of the template engine wrappers a the following if you want to use them with an embedded engine or in a JUnit test case:
<dependency>
<groupId>org.camunda.template-engines</groupId>
<artifactId>camunda-template-engines-freemarker</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.camunda.template-engines</groupId>
<artifactId>camunda-template-engines-velocity</artifactId>
<version>1.0.0</version>
</dependency>
<code>
<code>
<code>
As you can see the process variables in the current scope can directly be used in the template. The result of the processed template is than save in a local variable which is available inside of the service task.
<code>
Another interesting use case for templates are camunda connectors (added in 7.2.0-alpha2). As templates like scripts can be loaded from external resources it is possible to use the a SOAP envelope template in multiple processes or projects. An example for such an template can be found in our SOAP connector example.
<code>
<code>
As a side effect of this new feature we have demonstrated that you can now easily integrate own scripting-like languages in camunda BPM. If it is possible to create a JSR 223 compatible wrapper it can be used in camunda BPM.
<code>
To read more technical details about templating please visit our user guide. And please let us know what you think about this new feature.