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: Scheduled FTP polling -again
Date Sun, 05 Dec 2010 09:27:21 GMT
You may want to look at scheduled route policy when its avail in Camel 2.6
http://camel.apache.org/scheduledroutepolicy.html

The Loop DSL can use a predicate, so you can actually use it to loop
until there are no more files. The Exchange will be null.
But its a bit inefficient as it will re-connect to the FTP server on each poll.



On Tue, Nov 30, 2010 at 3:51 PM, mikaelfj <mikaelfj@gmail.com> wrote:
>
> Hi,
>
> I know there are several posts on this subject - but I need to have the
> following approach qualified.
>
> We need to fetch files from FTP and want to control when and how often this
> is done.
>
> (I'm aware that there is some upcoming feature to provide a DSL for the FTP
> component to control this, but we need to perform this functionality now)
>
> So, given earlier posts it seems as if I need to
> - use a quartz-URI to control when I want to poll
> - use a pollEnrich to fetch files
> - continue processing of fetched files.
>
> However, the pollEnrich will only fetch one file from the FTP server, so in
> order to get multiple files if needed I figure I could use a loop - e.g.
>
> from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI")
> .loop(ftpProcessor.count())
> .pollEnrich("ftp-uri")
> .process(ftpProcessor)
> .to(....)
>
> So the above will be triggered by quartz, and then X times
> - fetch a file from ftp
> - process it
> - deliver it to a destination
> ... provided that X is the count of available files on the FTP server.
> (well I could use the FTPClient to list the available files to calculate
> this ...)
>
> This would give me X files fetched from the FTP server at the scheduled
> times.
> (ofcourse files arriving just after the count is calculated will not be
> fetched)
>
> Would this be a reasonable approach?
>
> Regards
> Mikael
> --
> View this message in context: http://camel.465427.n5.nabble.com/Scheduled-FTP-polling-again-tp3286179p3286179.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message