You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by anand sridhar <an...@gmail.com> on 2012/01/26 01:00:25 UTC

reading http endpoint from properties files

Hi,
I have a route with the endpoint being a HTTP URL.
It so happens that this URL is in a  properties file.

Could some one help me to understand how I can dynamically load the end
point name from a property file or in general from header, property etc..?

apparently, none of these work

from("jms:q1")
.to("${properties:httpurl}")

or
from("jms:q1")
.to(header("httpurl"));

or

from("jms:q1")
.to(property("httpurl"));

does not resolve even though the httpurl parameter is present in header as
well as property.

Thanks,
Anand

Re: reading http endpoint from properties files

Posted by Marco Westermann <Ma...@gmx.de>.
Hi

what you need is the properties component. Look here: 
http://camel.apache.org/properties.html

then you can refer your endpoint like this

.to("{{myHttpEndpoint}}")

where you have that defined in your properties like this:

myHttpEndpoint=http://servername.com/test

regards, Marco

Am 26.01.2012 01:00, schrieb anand sridhar:
> Hi,
> I have a route with the endpoint being a HTTP URL.
> It so happens that this URL is in a  properties file.
>
> Could some one help me to understand how I can dynamically load the end
> point name from a property file or in general from header, property etc..?
>
> apparently, none of these work
>
> from("jms:q1")
> .to("${properties:httpurl}")
>
> or
> from("jms:q1")
> .to(header("httpurl"));
>
> or
>
> from("jms:q1")
> .to(property("httpurl"));
>
> does not resolve even though the httpurl parameter is present in header as
> well as property.
>
> Thanks,
> Anand
>


Re: reading http endpoint from properties files

Posted by Bilgin Ibryam <bi...@gmail.com>.
I think what you need is a dynamic router
http://camel.apache.org/dynamic-router.html
Did you look at it?

Bilgin

On 26 January 2012 00:00, anand sridhar <an...@gmail.com> wrote:
> Hi,
> I have a route with the endpoint being a HTTP URL.
> It so happens that this URL is in a  properties file.
>
> Could some one help me to understand how I can dynamically load the end
> point name from a property file or in general from header, property etc..?
>
> apparently, none of these work
>
> from("jms:q1")
> .to("${properties:httpurl}")
>
> or
> from("jms:q1")
> .to(header("httpurl"));
>
> or
>
> from("jms:q1")
> .to(property("httpurl"));
>
> does not resolve even though the httpurl parameter is present in header as
> well as property.
>
> Thanks,
> Anand

Re: reading http endpoint from properties files

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Feb 1, 2012 at 8:34 PM, anand sridhar <an...@gmail.com> wrote:
> The Property Place holder did the trick for me.
> However, I was hoping if I could extend it to read properties from the
> camel exchange .
> Any pointers to examples would be welcome.
>

If you want a dynamic to in Camel. Then take a look at this FAQ
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

For example the simple language can access both exchange properties
and the properties placeholder.

If you have a different use-case, then can you explain more why you
want the properties placeholder to access exchange headers? The
properties placeholders is resolved once, and not re-evaluated for
each message, so it cannot access properties from messages.


> Thanks,
> Anand
>
> On Thu, Jan 26, 2012 at 12:24 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> See this FAQ
>> http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
>>
>> Or you can define the endpoint using property placeholders
>> http://camel.apache.org/using-propertyplaceholder.html
>>
>> http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html
>>
>>
>> On Thu, Jan 26, 2012 at 1:00 AM, anand sridhar <an...@gmail.com>
>> wrote:
>> > Hi,
>> > I have a route with the endpoint being a HTTP URL.
>> > It so happens that this URL is in a  properties file.
>> >
>> > Could some one help me to understand how I can dynamically load the end
>> > point name from a property file or in general from header, property
>> etc..?
>> >
>> > apparently, none of these work
>> >
>> > from("jms:q1")
>> > .to("${properties:httpurl}")
>> >
>> > or
>> > from("jms:q1")
>> > .to(header("httpurl"));
>> >
>> > or
>> >
>> > from("jms:q1")
>> > .to(property("httpurl"));
>> >
>> > does not resolve even though the httpurl parameter is present in header
>> as
>> > well as property.
>> >
>> > Thanks,
>> > Anand
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>



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

Re: reading http endpoint from properties files

Posted by anand sridhar <an...@gmail.com>.
The Property Place holder did the trick for me.
However, I was hoping if I could extend it to read properties from the
camel exchange .
Any pointers to examples would be welcome.

Thanks,
Anand

On Thu, Jan 26, 2012 at 12:24 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> See this FAQ
> http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
>
> Or you can define the endpoint using property placeholders
> http://camel.apache.org/using-propertyplaceholder.html
>
> http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html
>
>
> On Thu, Jan 26, 2012 at 1:00 AM, anand sridhar <an...@gmail.com>
> wrote:
> > Hi,
> > I have a route with the endpoint being a HTTP URL.
> > It so happens that this URL is in a  properties file.
> >
> > Could some one help me to understand how I can dynamically load the end
> > point name from a property file or in general from header, property
> etc..?
> >
> > apparently, none of these work
> >
> > from("jms:q1")
> > .to("${properties:httpurl}")
> >
> > or
> > from("jms:q1")
> > .to(header("httpurl"));
> >
> > or
> >
> > from("jms:q1")
> > .to(property("httpurl"));
> >
> > does not resolve even though the httpurl parameter is present in header
> as
> > well as property.
> >
> > Thanks,
> > Anand
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: reading http endpoint from properties files

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

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

Or you can define the endpoint using property placeholders
http://camel.apache.org/using-propertyplaceholder.html
http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html


On Thu, Jan 26, 2012 at 1:00 AM, anand sridhar <an...@gmail.com> wrote:
> Hi,
> I have a route with the endpoint being a HTTP URL.
> It so happens that this URL is in a  properties file.
>
> Could some one help me to understand how I can dynamically load the end
> point name from a property file or in general from header, property etc..?
>
> apparently, none of these work
>
> from("jms:q1")
> .to("${properties:httpurl}")
>
> or
> from("jms:q1")
> .to(header("httpurl"));
>
> or
>
> from("jms:q1")
> .to(property("httpurl"));
>
> does not resolve even though the httpurl parameter is present in header as
> well as property.
>
> Thanks,
> Anand



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