My spring batch job running in a docker container reads data from DB and creates a flatfile. For now the file is created inside the container but when data is big, i want to create the flatfile in the remote SFTP location. What would be the best way to implement this without creating a physical file inside a container.
I would use the org.apache.commons.net.ftp.FTPClient
class, storeFileStream
method to obtain an OutputStream
, then write directly to that OutputStream
when reading rows from your database.