145.7. velocity Context
Camel 将在 Velocity 上下文(只使用 映射)中提供交换信息。Exchange 被传输为:
| key | value |
|---|---|
|
|
|
|
|
|
|
| In 消息的标头。 |
|
| Camel 上下文实例。 |
|
| In 消息。 |
|
| In 消息。 |
|
| In 消息正文。 |
|
| Out 消息(仅适用于 InOut 消息交换模式)。 |
|
| Out 消息(仅适用于 InOut 消息交换模式)。 |
您可以通过设置 property allowTemplateFromHeader=true 并设置消息标头 CamelVelocityContext 来自行设置自定义 Velocity ContextContext
VelocityContext velocityContext = new VelocityContext(variableMap);
exchange.getIn().setHeader("CamelVelocityContext", velocityContext);
VelocityContext velocityContext = new VelocityContext(variableMap);
exchange.getIn().setHeader("CamelVelocityContext", velocityContext);