Hi, At the moment, you cannot assign cron jobs with the FTP component. It would be a nice enhancement though. You could log this as an enhancement request using the Camel Jira link below.
https://issues.apache.org/activemq/secure/Dashboard.jspa https://issues.apache.org/activemq/secure/Dashboard.jspa For the timebeing, you could use a workaround. You could start a CamelContext at a given time using a quartz cron job and then let it run. The context would contain a route with the FTP endpoint which would be on a 24 hr delay. This should get you the effect you desire. BTW, I recently introduced a TimePatternConverter in Camel that can convert a timepattern such a 24h2m10s into a long millisecond value. You can therefore do the following (starting 2.3) from("ftp://sc...@localhost/public/reports?password=tiger&binary=true&consumer.delay=24h"). to("..."); Hope this helps. Cheers, Ashwin... leNerd wrote: > > 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://sc...@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 >>> >>> >>> >> >> > > ----- --- Ashwin Karpe, Sr. Principal Consultant, PS - Opensource Center of Competence Progress Software Corporation 14 Oak Park Drive Bedford, MA 01730 --- +1-972-304-9084 (Office) +1-972-971-1700 (Mobile) ---- Blog: http://opensourceknowledge.blogspot.com/ -- View this message in context: http://old.nabble.com/Scheduled-Polling-Consumer-on-FTP-endpoint-tp28678774p28681500.html Sent from the Camel - Users mailing list archive at Nabble.com.
