Simple Expression in apache-camel uri

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:46:44

问题


I'm new to apache-camel and know i met a problem. I want to use simple expressions in my uri definition, but i don't know how.

For example:

from("foo://bar").to("foo://bar?var=${header.varName}");

Is there a way to use such expressions?


回答1:


Bernhard

http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

Use the Recipient List EIP pattern, which allows you to compute the dynamic URI using an Expression. For example using the Simple expression language as shown below:

recipientList(simple("freemarker://templateHome/${body.templateName}.ftl"))



回答2:


Another way is to use the "CamelXsltResourceUri" property in the header.

.setHeader("CamelXsltResourceUri",simple("xslt:<path>/<to>/<template>"))

"recipientList(simple("freemarker://templateHome/${body.templateName}.ftl"))"

The selected answer did not work for me since I had to use a custom uriresolver



来源:https://stackoverflow.com/questions/8035194/simple-expression-in-apache-camel-uri

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!