...
Camel will store a reference to the resource in the message header in the key org.apache.camel.velocity.resource
. The Resource is an org.springframework.core.io.Resource
object.
Velocity Context
Camel will provide exchange information in the Velocity context (just a Map). The Exchange is transfered as:
key | value |
---|---|
exchange | The Exchange itself |
headers | The headers of 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) |
Hot reloading
The velocity template resource is by default hot reloadable for both file and classpath resources (expanded jar). Setting the contentCache=true then Camel will only load the resource once, and thus hot reloading is not possible. This scenario can be used in production usage when the resource never changes.
...
Code Block |
---|
Dear ${headers.lastName}, ${headers.firstName}
Thanks for the order of ${headers.item}.
Regards Camel Riders Bookstore
${body}
|
And the java code:
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=activemq/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityLetterTest.java} |
...