akshat
akshat

Reputation: 17

Mule Quartz polling FTP endpoint

I am using a quartz poller to poll a FTP endpoint, but my problem is that when the poller runs it won't pick up more than 1 file from the given path or directory , it will only pick one file. How can we pick up every file present at the time poller starts. ?

Thanks in anticipation.

Upvotes: 0

Views: 1894

Answers (2)

user2895096
user2895096

Reputation: 11

I've experienced the same problem and solved it using 2 separate flows. Also a custom receiver is used to avoid deletion of remote files, and a java component to notify completion of job, see the flow below:

<ftp:connector name="ftp-connector" passive="true" streaming="true" binary="true">
    <service-overrides messageReceiver="app.NonDeletingFtpMessageReceiver" />
</ftp:connector>

<ftp:endpoint name="ftp-fetch" connector-ref="ftp-connector"
    host="${pr.ftp.host}" port="${pr.ftp.port}" path="${pr.ftp.remotePath}"
    user="${pr.ftp.user}" password="${pr.ftp.password}">
    <file:filename-wildcard-filter pattern="${pr.ftp.filePattern}" />
</ftp:endpoint>

<quartz:endpoint name="quartz-batch" jobName="cron-job"
    cronExpression="${pr.ftp.cron}" responseTimeout="${pr.ftp.timeout}">
    <quartz:event-generator-job />
</quartz:endpoint>


<flow name="ftp-scheduler-flow" doc:name="ftp-scheduler-flow">
    <inbound-endpoint ref="quartz-batch" />
    <echo-component />
    <flow-ref name="ftp-process-fetch-flow" />
    <component class="app.FTPFetchHandler" />
</flow>

<flow name="ftp-process-fetch-flow">
    <inbound-endpoint ref="ftp-fetch" />
    <expression-filter evaluator="header"
        expression="originalFilename!=null" />
    <file:outbound-endpoint path="${pr.ftp.localPath}"
        responseTimeout="${pr.ftp.timeout}" outputPattern="#[header:originalFilename]" />
</flow>

Upvotes: 1

genjosanzo
genjosanzo

Reputation: 3264

The quartz polling endpoint message source is designed to process a single mule event each time it fires, therefor by design it will consume only a file.

This is reported as a bug, but looking at the code it should be probably be categorised as an enhancement request.

To obtain a different behaviour you should write your own custom component and use that to retrieve all the files from the ftp, or rely on the ftp transport itself.

HTH

Upvotes: 0

Related Questions