camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leNerd <lennart.petersson...@gmail.com>
Subject Re: Scheduled Polling Consumer on FTP endpoint
Date Wed, 26 May 2010 12:47:36 GMT

That doesn't quite make it, unfortunately. I did see the example you
mentioned prior to posting. It does not poll according to a schedule - e.g.
every day at 1 o'clock - but according to a timer with a given delay.

leNerd



Ashwin Karpe wrote:
> 
> Hi,
> 
> This capability is already available in the FTP component. You do not need
> to do pollEnrich etc.
> 
> Please check out the sample available in the link 
> http://camel.apache.org/ftp.html http://camel.apache.org/ftp.html 
> 
> The sample is given below.
> 
> Cheers,
> 
> Ashwin...
> 
> ----------------------------------------------------------------------------------
> protected RouteBuilder createRouteBuilder() throws Exception {
>     return new RouteBuilder() {
>         public void configure() throws Exception {
>             // we use a delay of 60 minutes (eg. once pr. hour we poll the
> FTP server
>             long delay = 60 * 60 * 1000L;
> 
>             // from the given FTP server we poll (= download) all the
> files
>             // from the public/reports folder as BINARY types and store
> this as files
>             // in a local directory. Camel will use the filenames from the
> FTPServer
> 
>             // notice that the FTPConsumer properties must be prefixed
> with "consumer." in the URL
>             // the delay parameter is from the FileConsumer component so
> we should use consumer.delay as
>             // the URI parameter name. The FTP Component is an extension
> of the File Component.
>            
> from("ftp://scott@localhost/public/reports?password=tiger&binary=true&consumer.delay="
> + delay).
>                 to("file://target/test-reports");
>         }
>     };
> }
> ----------------------------------------------------------------------------
> 
> 
> 
> leNerd wrote:
>> 
>> Hi!
>> I want to start a route using a quartz component with a cron statement.
>> Then use pollEnrich to obtain messages from an FTP server and forward
>> them via a route. Something along these lines (Java DSL):
>> 
>> from("quartz://scheduledpoll?cron=0/20+*+*+*+*+?")
>> 	.pollEnrich("ftp://" + props.getProperty("ftp.server") +
>> props.getProperty("ftp.inbox")
>> 				+ "?username=" + props.getProperty("ftp.user")
>> 				+ "&password=" + props.getProperty("ftp.password")
>> 				+ "&move=done")
>> 	.to("direct:someChannel");
>> 
>> 
>> The problem is then, that as the quartz endpoint issues its one message
>> per firing, the pollEnrich component only retrieves one (that is 1) file
>> from the FTP server, as opposed to the intended batch of all available
>> files!
>> 
>> The above is only an attempt to check a FTP server once in a while and
>> then retrieve all available files. I'm open to other solutions - also
>> using Spring XML DSL.
>> 
>> 
>> Reg. leNerd
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Scheduled-Polling-Consumer-on-FTP-endpoint-tp28678774p28680321.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message