363.8. サンプル
たとえば、次のようなものを使用できます
from("activemq:My.Queue").
  to("velocity:com/acme/MyResponse.vm");
from("activemq:My.Queue").
  to("velocity:com/acme/MyResponse.vm");
					Velocity テンプレートを使用して、InOut メッセージエクスチェンジ (JMSReplyTo ヘッダーがある場合) のメッセージへの応答を作成します。
				
InOnly を使用してメッセージを消費し、別の宛先に送信する場合は、次のルートを使用できます。
from("activemq:My.Queue").
  to("velocity:com/acme/MyResponse.vm").
  to("activemq:Another.Queue");
from("activemq:My.Queue").
  to("velocity:com/acme/MyResponse.vm").
  to("activemq:Another.Queue");
					また、.vm テンプレートが変更されない本番環境などでコンテンツキャッシュを使用するには、次のようにします。
				
from("activemq:My.Queue").
  to("velocity:com/acme/MyResponse.vm?contentCache=true").
  to("activemq:Another.Queue");
from("activemq:My.Queue").
  to("velocity:com/acme/MyResponse.vm?contentCache=true").
  to("activemq:Another.Queue");そしてファイルベースのリソース:
from("activemq:My.Queue").
  to("velocity:file://myfolder/MyResponse.vm?contentCache=true").
  to("activemq:Another.Queue");
from("activemq:My.Queue").
  to("velocity:file://myfolder/MyResponse.vm?contentCache=true").
  to("activemq:Another.Queue");Camel 2.1 では、コンポーネントがヘッダーを介して動的に使用するテンプレートを指定できます。たとえば、次のようになります。
from("direct:in").
  setHeader("CamelVelocityResourceUri").constant("path/to/my/template.vm").
  to("velocity:dummy?allowTemplateFromHeader=true");
from("direct:in").
  setHeader("CamelVelocityResourceUri").constant("path/to/my/template.vm").
  to("velocity:dummy?allowTemplateFromHeader=true");Camel 2.1では、ヘッダーを介してコンポーネントが動的に使用するヘッダーとして、テンプレートを直接指定することが可能です:
from("direct:in").
  setHeader("CamelVelocityTemplate").constant("Hi this is a velocity template that can do templating ${body}").
  to("velocity:dummy?allowTemplateFromHeader=true");
from("direct:in").
  setHeader("CamelVelocityTemplate").constant("Hi this is a velocity template that can do templating ${body}").
  to("velocity:dummy?allowTemplateFromHeader=true");
						allowTemplateFromHeader オプションを有効にすると、セキュリティー上の問題が発生します。たとえば、ヘッダーに信頼されていないコンテンツやユーザー派生コンテンツが含まれている場合、これは最終的にエンドアプリケーションの信頼性および完全性に影響を与える可能性があるため、このオプションは注意して使用してください。