Could anyone suggest the approach which I need to follow to achieve the below requirement?
Background:
There is a remote location for example "//severname/somefolder/somefile". Some files would be generating continuously for every second or minute in the remote location.
Spring boot application should be required to check continuously for the new files generating at a remote location (by some scheduler).
If files are available I required to read the oldest to latest file one by one and process them may store into the database.
Once Processed, the particular file is required to remove from the existing remote location and move to another remote location folder.
Points in my mind:
By using the spring batch we can read one file at a time. but how can we read the oldest file dynamically?
How to handle the scenario like: if my batch is processing one of the files is still in progress. if the schedular runs the job again there is a chance of picking the same file for processing.
Appreciate your solution and better suggestion :)