String Template
Render a StringTemplate (ST4) template with the data of the message and use the text it writes as the new message body.
What’s inside
-
String Template component, URI syntax:
string-template:resourceUri
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-stringtemplate-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 6 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.string-template.allow-context-map-all | Whether the attributes that the producer adds to the template from the exchange also include exchange, in, request, out, response, exchangeProperty, exchangeProperties and camelContext. If false, the template gets only the body, header, headers, variable, variables and exception attributes. Enabling it lets the template read the properties (getters and public fields) of the whole Exchange and CamelContext. The default for the endpoints of the component. | false | Boolean |
camel.component.string-template.allow-template-from-header | Whether the producer reads the CamelStringTemplateResourceUri, CamelStringTemplateTemplate and CamelStringTemplateVariableMap headers. If false, the producer ignores all three headers. Enable it only when the route sets these headers, not a message sender. The default for the endpoints of the component. | false | Boolean |
camel.component.string-template.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.string-template.content-cache | Whether the endpoints of the component cache their template, unless the contentCache option of the endpoint says otherwise. The producer then reads the template of resourceUri once and keeps its text, so it does not see changes to the resource until the cache is cleared, for example with the clearContentCache JMX operation of the endpoint. If false, the producer reads the resource on each exchange. The template text is compiled into an ST on each exchange in both cases. | true | Boolean |
camel.component.string-template.enabled | Whether to enable auto configuration of the string-template component. This is enabled by default. | Boolean | |
camel.component.string-template.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |