title: How to get Camel FTP to poll for files only once after route is invoked from CronScheduledRoutePolicy
body: <p>I am new to Camel FTP and need little help rather desperately to accomplish a task.</p>
  
  <p>I am working on a requirement to download couple of reports via FTP twice a month and upload them to SharePoint.</p>
  
  <p>I have configured an FTP Route with a filter to pickup required files and a route policy using CronScheduledRoutePolicy to run this route twice every month. Please see below configurations.</p>
  
  <pre><code>&lt;!-- FileName filter for ACE Report download from CSREPORT folder --&gt;
  &lt;bean id="aceReportFileNameFilter" class="com.xyz.ACEReportFileNameFilter" /&gt;
  
  &lt;bean id="aceReportDownloadStartPolicy"
      class="org.apache.camel.routepolicy.quartz2.CronScheduledRoutePolicy"&gt;
      &lt;!-- start every 2min from monday to saturday - TESTING --&gt;
      &lt;property name="routeStartTime" value="0 0/2 * ? * 1-6 *" /&gt;
      &lt;!-- Run every 2nd and 23rd of the month at 1AM - PRODUCTION --&gt;
      &lt;!-- &lt;property name="routeStartTime" value="0 0 1 2,23 * ? *" /&gt; --&gt;
  &lt;/bean&gt;
  
  &lt;routeContext id="aceReportDownload" xmlns="http://camel.apache.org/schema/spring"&gt;
      &lt;route autoStartup="false" id="CSReportFtp" routePolicyRef="aceReportDownloadStartPolicy"&gt;
          &lt;from id="_from1"
              uri="ftp://user:pwd@host:port/reportFolder?filter=#aceReportFileNameFilter" /&gt;
          &lt;log message="Testing ACE report FTP download" /&gt;
          &lt;to id="_to1" uri="file://{{downloadFolderPath}}/temp" /&gt;
      &lt;/route&gt;
  &lt;/routeContext&gt;
  </code></pre>
  
  <p>Route is downloading the files as per used filter however, its is polling for the files continuously rather than stopping having downloaded the files. Here are the logs from my machine.</p>
  
  <p>12:12:00.049 [DefaultQuartzScheduler-LISA_Worker-1] INFO  o.a.camel.spring.SpringCamelContext - Route: CSReportFtp started and consuming from: Endpoint[<a href="ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT?disconnect=true&amp;filter=%23aceReportFileNameFilter]" rel="nofollow noreferrer">ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT?disconnect=true&amp;filter=%23aceReportFileNameFilter]</a>
  12:12:01.235 [Camel (LISA) thread #0 - <a href="ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]" rel="nofollow noreferrer">ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]</a> INFO  CSReportFtp - Testing ACE report FTP download
  12:12:01.283 [Camel (LISA) thread #0 - <a href="ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]" rel="nofollow noreferrer">ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]</a> INFO  CSReportFtp - Testing ACE report FTP download
  12:12:01.815 [Camel (LISA) thread #0 - <a href="ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]" rel="nofollow noreferrer">ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]</a> INFO  CSReportFtp - Testing ACE report FTP download
  12:12:01.846 [Camel (LISA) thread #0 - <a href="ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]" rel="nofollow noreferrer">ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]</a> INFO  CSReportFtp - Testing ACE report FTP download
  12:12:02.407 [Camel (LISA) thread #0 - <a href="ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]" rel="nofollow noreferrer">ftp://PCP03D:xxxxxx@localhost:53556/CSREPORT]</a> INFO  CSReportFtp - Testing ACE report FTP download
  ........
  ........</p>
  
  <p>I want files to be downloaded only once as per CronScheduledRoutePolicy so that I can then upload reports to SharePoint.</p>
  
  <p>I have searched for possible solutions and tried couple of things like passing disconnect parameter to close FTP connection and trying to close Route using &lt; onCompletion> DSL etc. However, that has not worked.</p>
  
  <p>I have come across what looks like a workaround (I haven't tried it yet) like this one <a href="https://stackoverflow.com/questions/31819073/how-to-get-camel-ftp-to-fetch-only-once-on-demand?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">How to get Camel FTP to fetch only once on demand</a></p>
  
  <p>This is not the exact scenario for me.</p>
  
  <p>Can someone please advise on an intuitive solution for my requirement. Any help would be greatly appreciated. Thanks</p>