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?
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?
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"))
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
Use toD()
then dynamic uri can be used. recipientlist is for multiple destinations, not the correct EIP.
However you may need to avoid creating too many different URLs with your simple()
expression. See: https://camel.apache.org/components/3.18.x/eips/toD-eip.html