[ 
https://issues.apache.org/jira/browse/CAMEL-8966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14633174#comment-14633174
 ] 

Claus Ibsen commented on CAMEL-8966:
------------------------------------

I have a prototype that is just a string where you define the dynamic uri, and 
it allows to concat using different languages (something ppl have asked for)

For example to use a bit of xpath with a prefix you can do
{code}
                from("direct:start")
                    .toD("mock:+xpath:/order/@uri");
{code}

Notice the plus symbol that is used to denote as split between multiple 
expressions. Then you can prefix with the language to use (will use simple by 
default).

For example to have a header after the xpath you can do
{code}
                from("direct:start")
                    .toD("mock:+xpath:/order/@uri+header:sub");
{code}

So if you send a message with
{code}
        template.sendBodyAndHeader("direct:start", "<order uri=\"foo\"/>", 
"sub", "-123");
{code}

It ends up in the mock endpoint: mock:foo-123

> Add a dynamic to that is simpler to use than recipient list
> -----------------------------------------------------------
>
>                 Key: CAMEL-8966
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8966
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core, eip
>            Reporter: Claus Ibsen
>             Fix For: Future
>
>
> To do dynamic to then see this FAQ
> http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html
> I think we should consider a dynamic to variation, or make to dynamic out of 
> the box?
> For example to send a message to a dynamic computed uri with a header that 
> has a stock symbol name:
> {code}
> <toD uri="jms:queue:stock-${header.stock}"/>
> {code}
> Notice the toD for to dynamic.
> It should be as simple so its a one-liner like today. If you want a bit more 
> elaborate then use recipient list. Also the language it uses is simple only.
> We could also ponder about making that defailt for <to> to use simple 
> language. However a few components like file uses simple language in its 
> parameters. So we would need to tell simple to be lenient and keep tokens it 
> cannot parse at this time, so you can do: 
> {code}
> <to uri="file:inbox?fileName=backup-${file:name}"/>
> {code}
> So parsing 
> {code}
> ${file:name}
> {code}
>  don't barf



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to