Following the Spring integration ftp doc , I have managed to send files to ftp server through the java config way:
@MessagingGateway
public interface MyGateway {
@Gateway(requestChannel = "toFtpChannel")
void sendToFtp(File file);
}
ss
public static void main(String[] args) {
ConfigurableApplicationContext context =
new SpringApplicationBuilder(FtpJavaApplication.class)
.web(false)
.run(args);
MyGateway gateway = context.getBean(MyGateway.class);
// sending file to ftp server
gateway.sendToFtp(new File("/foo/bar.txt"));
}
It seems to me that the code above is using the custom method 'sendToFtp()' to send file to target ftp server. My question is that how to add other methods to the MyGateway interface to implement the operations?
ls (list files)
get (retrieve file)
mget (retrieve file(s))
rm (remove file(s))
mv (move/rename file)
put (send file)
mput (send multiple files)