You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by L F <l8...@yahoo.com.INVALID> on 2017/01/25 08:18:31 UTC
camel:propertyPlaceholder get value of a key specified as header
Hello camel users,
I have a spring DSL defined route and a properties file, where i have defined let's say some FTP connection endpoints.
the properties file looks like this:
ftp1=ftp://test1@host.comftp2=ftp://test2@host1.com......
and i have a header ftp.enpoint=ftp1
I would like to get one of the value based on a header value and use that in a <toD uri="{{${headers.ftp.endpoint}}"/>
Is it possible?
Regards,Laji
Re: camel:propertyPlaceholder get value of a key specified as header
Posted by Claus Ibsen <cl...@gmail.com>.
That is not possible as the property is a single entry, not a map structure.
Maybe you can just have multiple properties with the key name included
ftp.endpoint.foo=xxx
ftp.endpoint.bar=xxx
And then select it using the properties function from simple
toD("${properties:ftp.endpoint.${header.withKeyName}}")
On Thu, Jan 26, 2017 at 1:57 PM, L F <l8...@yahoo.com.invalid> wrote:
> Hello,
>
> in the properties file would be one entry (row) for each ftp server, ftp1, ftp2...
> The key is specified in a header. Now i would like to get the value of the property using the header value as a key.
> Somehow the properties entries got concatenated in the previous mail.
> Kind regardsLaji
>
>
>
> On Thursday, January 26, 2017 2:04 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>
> Its not super easy but you need to use a separator in your properties
> file for the ftp servers
>
> And then you can use the split method and grab the first array
>
> Something a like
> ${headers.ftp.endpoint.split(";")[0]}
>
>
>
> On Wed, Jan 25, 2017 at 9:18 AM, L F <l8...@yahoo.com.invalid> wrote:
>> Hello camel users,
>> I have a spring DSL defined route and a properties file, where i have defined let's say some FTP connection endpoints.
>> the properties file looks like this:
>> ftp1=ftp://test1@host.comftp2=ftp://test2@host1.com......
>> and i have a header ftp.enpoint=ftp1
>> I would like to get one of the value based on a header value and use that in a <toD uri="{{${headers.ftp.endpoint}}"/>
>>
>> Is it possible?
>> Regards,Laji
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>
>
>
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: camel:propertyPlaceholder get value of a key specified as
header
Posted by L F <l8...@yahoo.com.INVALID>.
Hello,
in the properties file would be oneĀ entry (row) for each ftp server, ftp1, ftp2...
The key is specified in a header. Now i would like to get the value of the property using the header value as a key.
Somehow the properties entries got concatenated in the previous mail.
Kind regardsLaji
On Thursday, January 26, 2017 2:04 PM, Claus Ibsen <cl...@gmail.com> wrote:
Its not super easy but you need to use a separator in your properties
file for the ftp servers
And then you can use the split method and grab the first array
Something a like
${headers.ftp.endpoint.split(";")[0]}
On Wed, Jan 25, 2017 at 9:18 AM, L F <l8...@yahoo.com.invalid> wrote:
> Hello camel users,
> I have a spring DSL defined route and a properties file, where i have defined let's say some FTP connection endpoints.
> the properties file looks like this:
> ftp1=ftp://test1@host.comftp2=ftp://test2@host1.com......
> and i have a header ftp.enpoint=ftp1
> I would like to get one of the value based on a header value and use that in a <toD uri="{{${headers.ftp.endpoint}}"/>
>
> Is it possible?
> Regards,Laji
>
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: camel:propertyPlaceholder get value of a key specified as header
Posted by Claus Ibsen <cl...@gmail.com>.
Its not super easy but you need to use a separator in your properties
file for the ftp servers
And then you can use the split method and grab the first array
Something a like
${headers.ftp.endpoint.split(";")[0]}
On Wed, Jan 25, 2017 at 9:18 AM, L F <l8...@yahoo.com.invalid> wrote:
> Hello camel users,
> I have a spring DSL defined route and a properties file, where i have defined let's say some FTP connection endpoints.
> the properties file looks like this:
> ftp1=ftp://test1@host.comftp2=ftp://test2@host1.com......
> and i have a header ftp.enpoint=ftp1
> I would like to get one of the value based on a header value and use that in a <toD uri="{{${headers.ftp.endpoint}}"/>
>
> Is it possible?
> Regards,Laji
>
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2