I was reading through the Spring Integration Documentation thinking that a file download would be pretty simple to implement. Instead, the article provided me with many different components that seem to over-qualify my needs:
The FTP Inbound Channel Adapter is a special listener that will connect to the FTP server and will listen for the remote directory events (e.g., new file created) at which point it will initiate a file transfer.
The streaming inbound channel adapter produces message with payloads of type InputStream, allowing files to be fetched without writing to the local file system.
Let's say I have a SessionFactory
declared as follows:
@Bean
public SessionFactory<FTPFile> ftpSessionFactory() {
DefaultFtpSessionFactory sf = new DefaultFtpSessionFactory();
sf.setHost("localhost");
sf.setPort(20);
sf.setUsername("foo");
sf.setPassword("foo");
return new CachingSessionFactory<>(sf);
}
How do I go from here to downloading a single file on a given URL?