You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by camel_user <ma...@hotmail.com> on 2012/06/16 10:13:41 UTC

Camel dynamic properties placeholder substitution in Spring XML

Hi, 

Is there a way in camel to substitute property placeholders in Spring XML?
What I mean by this is something along the lines of:

In my properties file I want to have:

dynamic.path=direct:myvery{0}complexroutename

and in spring XML 

<route>
	<from uri="direct:someuri" />
	<to uri="${properties:dynamic.path}" />
</route>

however the {0} bit in the route is dynamic and has to be injected at
runtime.

I guess in java DSL I could use something like this to get the dynamic route

String route=MessageFormat.format((String) props.get("dynamic.path"),
"substitution");

But is there anything similar that can be done in Spring xml?

Thanks!


--
View this message in context: http://camel.465427.n5.nabble.com/Camel-dynamic-properties-placeholder-substitution-in-Spring-XML-tp5714573.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel dynamic properties placeholder substitution in Spring XML

Posted by camel_user <ma...@hotmail.com>.
Thanks Claus,

Looks like the only way to do this is vi a Java bean and use:

String route=MessageFormat.format((String) props.get("dynamic.path"),
"substitution"); 

And then set a property value to be used in Spring XML

--
View this message in context: http://camel.465427.n5.nabble.com/Camel-dynamic-properties-placeholder-substitution-in-Spring-XML-tp5714573p5714576.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel dynamic properties placeholder substitution in Spring XML

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See these FAQs
http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

On Sat, Jun 16, 2012 at 10:13 AM, camel_user <ma...@hotmail.com> wrote:

> Hi,
>
> Is there a way in camel to substitute property placeholders in Spring XML?
> What I mean by this is something along the lines of:
>
> In my properties file I want to have:
>
> dynamic.path=direct:myvery{0}complexroutename
>
> and in spring XML
>
> <route>
>        <from uri="direct:someuri" />
>        <to uri="${properties:dynamic.path}" />
> </route>
>
> however the {0} bit in the route is dynamic and has to be injected at
> runtime.
>
> I guess in java DSL I could use something like this to get the dynamic
> route
>
> String route=MessageFormat.format((String) props.get("dynamic.path"),
> "substitution");
>
> But is there anything similar that can be done in Spring xml?
>
> Thanks!
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-dynamic-properties-placeholder-substitution-in-Spring-XML-tp5714573.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen