Yes, if there is no file that ftp endpoint poll, the onCompletion will never be called, so this route will not be shutdown.

Maybe we can consider to add a option on generic file endpoint to break the polling loop if there is no file can be polled.

Willem


ankelee wrote:
Hi

I have a setup where I start a route with with a quartz timer. This route
then starts another route that does the actual work of fetching files from
an ftp and then shuts down.

The problem with this workaround is that the ftp-fetching route will never
shut down if there are no messages on the ftp since it is a message reaching
the end of the route that activates the shut down.

Any ideas how to fix this? :)

<!-- Scheduled start-FTP trigger route -->
<route id="StartFtpTriggerRoute" autoStartup="true">
        <from uri="quartz://scheduledpoll?cron={{cron.poll}}" />
        <setHeader headerName="routeToStart">
                <constant>FtpPollingRoute</constant>
        </setHeader>
<bean ref="RouteController" method="start" /> <stop />
</route>

<!-- Route-stopping route -->
<route>
        <from uri="seda:StopRouteRoute" />
        <bean ref="RouteController" method="stop" />
</route>

<!-- FTP polling route -->
<route id="FtpPollingRoute" errorHandlerRef="deadLetterErrorHandler"
autoStartup="false">
        <from
uri="ftp:{{ftp.server}}{{ftp.inbox}}?username={{ftp.user}}&amp;password={{ftp.password}}&amp;delete=true&amp;disconnect=true"
/>
        <onCompletion>
                <filter>
                        <simple>${property.CamelBatchComplete} == true</simple>
                        <setHeader headerName="routeToStop">
                                <constant>FtpPollingRoute</constant>
                        </setHeader>
                        <to uri="seda:StopRouteRoute" />
                </filter>
        </onCompletion>
        <to uri="file:data" />
</route>



Reply via email to