You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by berdoni <be...@gmail.com> on 2013/09/26 18:43:42 UTC

Use property placeholders in CronScheduledRoutePolicy

Hi,

I use CronScheduledRoutePolicy to schedule the execution on a File route.

CronScheduledRoutePolicy routePolicy = new CronScheduledRoutePolicy();

routePolicy.setRouteStartTime("0 0/5 * * * ?");
routePolicy.setRouteStopTime("59 0/2 * * * ?");

Is it possible to use property placeholders and load the cron values from a
property file 

e.g.
routePolicy.setRouteStartTime({{routeStartTime.value}});

or this is applicable only in parts of the endpoint URI's?

thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Use-property-placeholders-in-CronScheduledRoutePolicy-tp5740264.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Use property placeholders in CronScheduledRoutePolicy

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

You can use the  resolvePropertyPlaceholders from camelContext.

Or use the @PropertyInject from Camel 2.12 to inject the property to a
getter/setter on the java bean (eg to do dependency injection)

On Thu, Sep 26, 2013 at 5:43 PM, berdoni <be...@gmail.com> wrote:
> Hi,
>
> I use CronScheduledRoutePolicy to schedule the execution on a File route.
>
> CronScheduledRoutePolicy routePolicy = new CronScheduledRoutePolicy();
>
> routePolicy.setRouteStartTime("0 0/5 * * * ?");
> routePolicy.setRouteStopTime("59 0/2 * * * ?");
>
> Is it possible to use property placeholders and load the cron values from a
> property file
>
> e.g.
> routePolicy.setRouteStartTime({{routeStartTime.value}});
>
> or this is applicable only in parts of the endpoint URI's?
>
> thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Use-property-placeholders-in-CronScheduledRoutePolicy-tp5740264.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

Re: Use property placeholders in CronScheduledRoutePolicy

Posted by berdoni <be...@gmail.com>.
Thanks Cristian, thanks Claus,

finally I have defined my policies of CronScheduledRoutePolicy as beans and
their cron expressions are loaded with the standard Spring
PropertyPlaceholder mechanism. The routePolicy beans are injected to Camel
Routes as Cristian suggested. I think it's ugly but it works :)

Claus, Camel 2.10.4 is my target version due to SMX.

thanks
Nikos



--
View this message in context: http://camel.465427.n5.nabble.com/Use-property-placeholders-in-CronScheduledRoutePolicy-tp5740264p5740435.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Use property placeholders in CronScheduledRoutePolicy

Posted by Christian Müller <ch...@gmail.com>.
Use a dependency injection framework to inject the value as instance
variable.

Best,
Christian
Am 27.09.2013 08:31 schrieb "berdoni" <be...@gmail.com>:

> Hi,
>
> I use CronScheduledRoutePolicy to schedule the execution on a File route.
>
> CronScheduledRoutePolicy routePolicy = new CronScheduledRoutePolicy();
>
> routePolicy.setRouteStartTime("0 0/5 * * * ?");
> routePolicy.setRouteStopTime("59 0/2 * * * ?");
>
> Is it possible to use property placeholders and load the cron values from a
> property file
>
> e.g.
> routePolicy.setRouteStartTime({{routeStartTime.value}});
>
> or this is applicable only in parts of the endpoint URI's?
>
> thanks
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Use-property-placeholders-in-CronScheduledRoutePolicy-tp5740264.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>