camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Set directory at runtime with file:
Date Tue, 11 Feb 2014 19:31:09 GMT
Hi

The from in a Camel route can only be configured once prior to the
route being started etc.
You cannot change that at runtime during the route is running.

There is no dynamic from.



On Tue, Feb 11, 2014 at 7:23 PM, mister blinky <misterblinky@gmail.com> wrote:
> I am using Camel 2.12.2.
>
> I assume this is supported, but I've been looking and looking all day and
> found nothing.
>
> I load properties and apply them to generic routes. All the route's
> particulars -- the URI -- are defined in the properties file. The route
> knows how to look up its properties because the pattern is static as
> follows:
>
> <routeType>.<propertyId>.property
>
> For example,
>
> move.testupload.directory=c:\\Temp
>
> The route resolves these as follows: a) the <propertyId> is passed in as a
> header setHeader("propId", "sometest"). The properties are then resolved
> like this:
>
> .log("directory = ${properties:move.${header.propId}.dir}")
>
> My first question is: is this a reasonable strategy? Is there a better way
> to accomplish this?
>
> My main question is how to use this dynamic property lookup in "file" to
> specify the directory?
>
> from("file://<directory> ...")
>
> This doesn't work:
>
> from("file://${properties:move.${header.propId}.dir}?noop=true")
>
> I tried passing in as header. Same problem -- ${} is not allowed in the URI.
>
> I would have thought the file component would have a way to set the
> directory as an argument (a la fileName). Some writers have suggested that
> you could use fileName= but I have not been able to get it to work.
>
> .from("file://?noop=true&fileName=${properties:move.${header.propsId}.dir}")
>
> I can't use the straight property language because it's not dynamic
> ("testupload" is hardcoded, not gleaned from a header value).
>
> .from("file://{{move.testupload.from.dir}}?noop=true")
>
> Any specific help is appreciated.
>
> I've used recipientList when the URI is in a to() -- is there a equivalent
> to recipientList for from()?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Set-directory-at-runtime-with-file-tp5747126.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Mime
View raw message