You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by mister blinky <mi...@gmail.com> on 2014/02/11 19:23:25 UTC
Set directory at runtime with file:
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.
RE: Set directory at runtime with file:
Posted by Ra...@cognizant.com.
Hi
You can add routes dynamically once Camel starts, though dynamic from is not possible.
Look at the following thread for more inputs.
http://stackoverflow.com/questions/10451444/add-camel-route-at-runtime-in-java
-Ravi
________________________________________
From: mister blinky [misterblinky@gmail.com]
Sent: Wednesday, February 12, 2014 1:51 AM
To: users@camel.apache.org
Subject: Re: Set directory at runtime with file:
thanks I appreciate the definitive reply !!!
My workaround is to construct a new route (as you imply) and to pass the
header value into the constructor for the route.
Is dynamic from likely to become a camel feature?
again, thx.
--
View this message in context: http://camel.465427.n5.nabble.com/Set-directory-at-runtime-with-file-tp5747126p5747130.html
Sent from the Camel - Users mailing list archive at Nabble.com.
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.
Re: Set directory at runtime with file:
Posted by mister blinky <mi...@gmail.com>.
thanks I appreciate the definitive reply !!!
My workaround is to construct a new route (as you imply) and to pass the
header value into the constructor for the route.
Is dynamic from likely to become a camel feature?
again, thx.
--
View this message in context: http://camel.465427.n5.nabble.com/Set-directory-at-runtime-with-file-tp5747126p5747130.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Set directory at runtime with file:
Posted by Claus Ibsen <cl...@gmail.com>.
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 <mi...@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