Rai Rai - 23 days ago 11
Java Question

Mule file connector without polling

I am wondering if mule file connector always polls the source directory, or if this behavior can be overridden.

I configured an end point to read a file from FTP location using file connector and then process it. But my requirement is that the file should be read only when requested, for example when endpoint is called from Java. By controlling this behavior I can call endpoint point at the end of day and read all files placed at source during the day.

But mule keeps on polling the source location and downloads the file as soon as it is placed at the source. I tried to see if I can achieve my desired behavior by service override, but it does not seem obvious that it is possible.

Is there a different way to read a file from the source or can polling behavior be overridden in mule?

Answer Source

You can achieve this is by following approaches

  1. Use Poll Schedular with Cron Scheduler for picking file automatically at fixed time of the day.
  2. For manual triggering you can expose HTTP endpoint and pick files using mule-module-requester in your flow. Mule requester allows you to pick singe or multiple resources.

Hope this helps.