camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pontus Ullgren <ullg...@gmail.com>
Subject Re: How to schedule FTP with quartz?
Date Mon, 18 Mar 2013 20:57:32 GMT
Hello Chris,

On Mon, Mar 18, 2013 at 8:54 PM, Chris Wolf <cwolf.algo@gmail.com> wrote:
> Claus,
>
> I have a few further questions about CronScheduledRoutePolicy.  I
> noticed that it has setters such as setRouteStartTime,
> setRouteStopTime, each which takes a cron expression string.  What I'm
> looking for is to be able to use a cron expression for the start, but
> a relative time length for stop.   Otherwise, I need to write code to
> parse the start time expression, then calculate a stop time cron
> expression.  Any ideas?
>
Depending on your needs you could enable "sendEmptyMessageWhenIdle" on
the endpoint and then suspend the route when you receive a empty
message. Which means that there is no more files to poll at the
moment.
You can use the content based route EIP for this.

Another solution would be to write your own RoutePolicy to take care
of your needs.

I just started to wonder if it might be possible to combine the
CronScheduledRoutePolicy with a SimpleScheduledRoutePolicy.
I have _not_ tested this so I'm not sure if it works. It might be that
there is a collision in the way they work with Quartz.

> Also I see that CronScheduledRoutePolicy has setRouteResumeTime,
> setRouteSuspendTime such that for my FTP poll window, I could either
> do start/stop or resume/suspend - which is recommended?
>
I would highly recommend resume/suspend.
I've had some thread leak problem with the file component when it was
repetitively started/stopped.

// Pontus

> Thanks,
>
> Chris
>
> On Sat, Mar 2, 2013 at 1:43 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
>> Hi
>>
>> See about route policy
>> http://camel.apache.org/routepolicy
>>
>> And the scheduled route policy
>> http://camel.apache.org/scheduledroutepolicy.html
>>
>> On Sat, Mar 2, 2013 at 12:15 AM, Chris Wolf <cwolf.algo@gmail.com> wrote:
>>> I have a requirement to download files via FTP during a certain time
>>> window and according to a schedule. e.g. Only on trading days between
>>> 6:30AM and 7:00AM.  The FTP component, alone, seems to just do
>>> indefinite polling according to delay/initialDelay.
>>>
>>> From the "Camel In Action" book, chapter 7, I see some examples of
>>> sending a text message with the Timer and Quartz components, but I
>>> can't quite see how to put that together to implement "kicking off
>>> routes at specified intervals", mentioned in the best practices list
>>> at the end of that chapter.  How would I use quartz to stop/start the
>>> FTP component, or the route that it's in?
>>>
>>> Thanks,
>>>
>>> Chris
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: cibsen@redhat.com
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message