Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-stringtemplate</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI

...

Format

Code Block
string-template:templateName[?options]

...

Div
classconfluenceTableSmall

Option

Default

Description

contentCache

false

Cache for the resource content when its loaded.
Note: as of Camel 2.9 cached resource content can be cleared via JMX using the endpoint's clearContentCache operation.

delimiterStart

null

Since From Camel 2.11.1, : configuring the variable start delimiter

delimiterStop

null

Since From Camel 2.11.1, : configuring the variable end delimiter

...

Camel will store a reference to the resource in the message header with key, org.apache.camel.stringtemplate.resource. The Resource is an org.springframework.core.io.Resource object.

Hot

...

-Reloading

The string template resource is by default hot-reloadable for both file and classpath resources (expanded jar). If you set contentCache=true, Camel loads will load the resource only just once and , disabling hot-reloading is not possible. This scenario can be used in production when the resource never changes.

...

Div
classconfluenceTableSmall

keyKey

valueValue

exchange

The Exchange itself.

headers

The headers of the In the IN message.

camelContext

The Camel Context.

request

The IN message.

in

The IN message.

body

The IN message body.

out

The OUT message (only for InOut message exchange pattern).

response

The OUT message (only for InOut message exchange pattern).

From Camel 2.14, : you can define the custom context map by setting the message header CamelStringTemplateVariableMap just like the below code., as shown below:

Code Block
languagejava
Map<String, Object> variableMap = new HashMap<String, Object>();
Map<String, Object> headersMap = new HashMap<String, Object>();
headersMap.put("name", "Willem");
variableMap.put("headers", headersMap);
variableMap.put("body", "Monday");
variableMap.put("exchange", exchange);
exchange.getIn().setHeader("CamelStringTemplateVariableMap", variableMap);

...

Code Block
from("activemq:My.Queue").
  .to("string-template:com/acme/MyResponse.tm");

...