Hi

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

On Mon, Oct 21, 2013 at 12:20 AM, javag <zenma...@gmail.com> wrote:
> I have a route in camel.xml like:
>
> <route>
>
>                         <from uri="jms:myfoo" />
>                         <doTry>
>                                 <validate><simple>${body[subsc]} regex 
> '[a-z0-9]{8}' </simple>
> </validate>
>                                 <choice>
>                                         <when>
>                                                 <simple>${body[mykey]} regex 
> '^(T1|T2)$'</simple>
>                                                 <choice>
>                                                     <when>
>                                                            
> <simple>${body[serviceName]} == 'getList'</simple>
>                                                                <to 
> uri="jms:bar.${body[mykey]}.state" />
>                                                      </when>
>                                                 </choice>
>                                         </when>
>                                         <otherwise>
>                                         <to uri="jms:invalid" />
>                                         <stop />
>                                         </otherwise>
>                                 </choice>
>                         <doCatch>
>                                 
> <exception>org.apache.camel.ValidationException</exception>
>                                 <to uri="jms:invalid"/>
>                         </doCatch>
>                         </doTry>
>
>                 </route>
>
>
> When I start activemq and send a message, validation passes and it matches
> ${body[mykey]} to either T1 or T2  but the message is sent to literally to
> bar.${body[mykey]}.state instead of to bar.T1.state or bar.T2.state  i.e.
> it does not substitute the variable body[mykey].
>
> Any idea what is causing this problem? According to camel docs it should
> work but it is not working.?
>
> I am using camel 2.10.3 and activemq 5.8.0.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-is-not-substituting-variable-expression-in-route-tp5741934.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to