Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recursively polling remote directory using spring integration SFTP file inbound channel adapter

Is there way I can recursively poll a remote directory using SFTP inbound channel adapter or do I have to have multiple inbound channel adapter one for each sub directory.

My use case is that, each tenant will have a sub directory inside upload directory where they can drop csv files, our application should pool the upload directory to see if any tenant has new files then start downloading locally. Locally it will have the same folder structure.

Remote:

/upload/tenant1/*.csv

/upload/tenant2/*.csv

Local:

/upload/tenant1/*.csv

/upload/tenant2/*.csv

like image 607
Mallikarjun Avatar asked Oct 20 '22 20:10

Mallikarjun


1 Answers

I assume you mean poll not pool.

You can use the sftp outbound gateway to recursively list (ls) or fetch (mget) from a directory tree.

With mget you can reflect the remote directory structure locally.

like image 168
Gary Russell Avatar answered Oct 23 '22 01:10

Gary Russell