Hi
What version of Camel are you using?
You need Camel 2.9 or better to have support for nested ${ } in the
simple language.
So in older releases you cannot do what you want. But you often do not
need to refer to the location in the simple expression. Just refer
only to the key, as you have already configured the locations on the
properties component.
When configuring the PropertiesComponent, you set a location(s) where
the properties are.
Usually that is .properties files. And that location paramater
supports ${env} etc to refer to a JVM system property etc.
At runtime when using the properties, you would need to refer the
*keys* of the properties, and *not* the .property files.
So if you have a foo.properties file that has the following values
[email protected]
Then in the simple expression you can refer to the key "email.from"
simple("${properties:email.from}")
On Sat, Jan 21, 2012 at 12:42 AM, anand sridhar <[email protected]> wrote:
> Hi,
> I have a set up where I maintain user properties in a properties file
> [xyz.properties] and i store it in different directories based on
> environment for eg dev/xyz.properties in dev and prod/xyz.properties in
> prod.
>
> Now, I pass the environment type using JVM param -Denv = prod/dev etc..
> All these folders are in classpath.
>
> So far, I have got the following things working with Camel -
>
> 1. Registering this property file using
> [code]
> PropertiesComponent pc = new PropertiesComponent();
> pc.setLocation("classpath:${env}/xyz.properties");
> camelContext.addComponent("properties", pc);
> [code]
>
> 2. I can look up end points dynamically using -
> [code]
> from("direct:email")
> .id("emailEP")
> .to("properties:{{smtp.address}}")
> .end();
> [code]
>
>
> However, I cannot look up properties for Simple expression evaluation . For
> e.g
> setHeader("From",simple("${properties:${env:env}/xyz.properties:alert.email.from}"))
>
> I have tried alternatives such as
> setHeader("From",simple("${properties:${env}/xyz.properties:alert.email.from}"))
>
> Any clues on the correct way to look up. ?
>
> Thanks.
> Anand
--
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/