50.7. Samples
示例示例如下。
from("activemq:My.Queue").
to("jslt:com/acme/MyResponse.json");
from("activemq:My.Queue").
to("jslt:com/acme/MyResponse.json");
以及基于文件的资源:
from("activemq:My.Queue").
to("jslt:file://myfolder/MyResponse.json?contentCache=true").
to("activemq:Another.Queue");
from("activemq:My.Queue").
to("jslt:file://myfolder/MyResponse.json?contentCache=true").
to("activemq:Another.Queue");
您还可以指定组件应通过标头使用哪个 JSLT 表达式,例如:
from("direct:in").
setHeader("CamelJsltResourceUri").constant("path/to/my/spec.json").
to("jslt:dummy?allowTemplateFromHeader=true");
from("direct:in").
setHeader("CamelJsltResourceUri").constant("path/to/my/spec.json").
to("jslt:dummy?allowTemplateFromHeader=true");
或通过标头发送整个 jslt 表达式:(可用于查询)
from("direct:in").
setHeader("CamelJsltString").constant(".published").
to("jslt:dummy?allowTemplateFromHeader=true");
from("direct:in").
setHeader("CamelJsltString").constant(".published").
to("jslt:dummy?allowTemplateFromHeader=true");
将交换属性传递给 jslt 表达式可以如下所示
from("direct:in").
to("jslt:com/acme/MyResponse.json?allowContextMapAll=true");
from("direct:in").
to("jslt:com/acme/MyResponse.json?allowContextMapAll=true");