109.7. 샘플
예를 들어 다음과 같은 것을 사용할 수 있습니다.
from("activemq:My.Queue"). to("freemarker:com/acme/MyResponse.ftl");
from("activemq:My.Queue").
to("freemarker:com/acme/MyResponse.ftl");
FreeMarker 템플릿을 사용하여 InOut 메시지 교환( JMSReplyTo
헤더가 있는 경우) 메시지에 대한 응답을 공식화합니다.
InOnly를 사용하고 메시지를 사용하고 다른 목적지로 보내려면 다음을 사용할 수 있습니다.
from("activemq:My.Queue"). to("freemarker:com/acme/MyResponse.ftl"). to("activemq:Another.Queue");
from("activemq:My.Queue").
to("freemarker:com/acme/MyResponse.ftl").
to("activemq:Another.Queue");
또한 .ftl
템플릿을 핫 다시 로드해야 하는 개발 사용과 같이 콘텐츠 캐시를 비활성화하려면 다음을 실행합니다.
from("activemq:My.Queue"). to("freemarker:com/acme/MyResponse.ftl?contentCache=false"). to("activemq:Another.Queue");
from("activemq:My.Queue").
to("freemarker:com/acme/MyResponse.ftl?contentCache=false").
to("activemq:Another.Queue");
파일 기반 리소스:
from("activemq:My.Queue"). to("freemarker:file://myfolder/MyResponse.ftl?contentCache=false"). to("activemq:Another.Queue");
from("activemq:My.Queue").
to("freemarker:file://myfolder/MyResponse.ftl?contentCache=false").
to("activemq:Another.Queue");
Camel 2.1 에서는 헤더를 통해 구성 요소가 동적으로 사용해야 하는 템플릿을 지정할 수 있습니다. 예를 들면 다음과 같습니다.
from("direct:in"). setHeader(FreemarkerConstants.FREEMARKER_RESOURCE_URI).constant("path/to/my/template.ftl"). to("freemarker:dummy");
from("direct:in").
setHeader(FreemarkerConstants.FREEMARKER_RESOURCE_URI).constant("path/to/my/template.ftl").
to("freemarker:dummy");