1
votes

I have a use case where a user drop multiple csv files into remote directory and then place a ready.txt to indicate that files are ready to consume. Our applcation when it see a ready.txt file in the remote directory it should start copying all the files into local directory including ready.txt using sftp file inbound channel adapter. Is there a way to make sure readt.txt file is the last file to be copied to local directory?

Because when files are copied from remote directory to local directory, I have another file inbound channel adapter looking for the ready.txt file inside local directory, when found initiate my batch process which depends on all the csv files copied from remote. The thing here is those files has to be executed in a ORDER. Copying ready.txt file last will make sure I have all the files so I can start my batch process.

Pardon with my english, bottom line is I want ready.txt to be last file to be copied to my local directory to make sure all csv files are copied.

Thanks

Mallikarjun

1

1 Answers

0
votes

You can use a custom FileListFilter on the inbound adapter; the adapter calls filterFiles() and will fetch the files in the order returned. You can return an empty list until ready.txt is found; when it is present, simply re-order the list and put ready.txt at the end.