
Questions: 23,729 //
Answers: 52,300 //
Contributing Members: 17,997
Hi Team,
How can I use inbound file connector which will read a file from directory only if it is modified since last read? Basically I am trying to read the configuration file only if it is modified. If it is modified then run the flow again.
Thanks & Regards, Vikas Gite
Could you please elaborate a little more. will read a file from directory only if it is modified since last read
Does this mean you want to track the last file read time in Mule for comparison ?
Yes (may be a checksum not necessarily time), actually since I am reading a config file, if the configuration has changed then only I want to read it again using file connector. Is file connector provide such feature out of the box?
File Connector does not provide such feature. Generally this kind of requirements is done using Poll scope and Watermark (since this requires storing some comparison element in Mule, watermark will store last read time) . Inside the Poll you can check whether the File is changed or not using Files API and compare with watermark
Later can use Mule Requester module along with this to retrieve the file.
Apr 19, 2017 at 09:57 AM, exploremule_3008 answered with:
Hi Vikas,
Please go thru the link below, https://forums.mulesoft.com/questions/41156/read-files-which-are-in-read-only-files-using-file.html
As explained in it, if you are using a file connector once the file is read it should be moved to another location otherwise it will keep on polling the same file.
So its not advisable to use file connector for your requirement, try to put some java transformers and get the work done.