I try to get file updates from the ftp server (and if a new file is added), but the code gets the file updates from the local directory, creating a new folder with the name
@Bean
public FtpInboundFileSynchronizer ftpInboundFileSynchronizer() {
FtpInboundFileSynchronizer fileSynchronizer =
new FtpInboundFileSynchronizer(ftpSessionFactory());
fileSynchronizer.setDeleteRemoteFiles(false);
fileSynchronizer.setRemoteDirectory("/");
fileSynchronizer.setRemoteFileSeparator("/");
fileSynchronizer.setFilter(new FtpSimplePatternFileListFilter("*"));
return fileSynchronizer;
}
@Bean
@InboundChannelAdapter(channel = "ftpChannel")
public MessageSource<File> ftpMessageSource() {
FtpInboundFileSynchronizingMessageSource source =
new FtpInboundFileSynchronizingMessageSource(fileSynchronizer);
source.setLocalDirectory(new File("/FTP_Test"));
source.setAutoCreateLocalDirectory(true);
source.setLocalFilter(new AcceptOnceFileListFilter<File>());
return source;
}
private SessionFactory<FTPFile> ftpSessionFactory() {
DefaultFtpSessionFactory sf = new DefaultFtpSessionFactory();
sf.setHost(host);
sf.setPort(port);
sf.setUsername(username);
sf.setPassword(password);
return new CachingSessionFactory<FTPFile>(sf);
}
what am I doing wrong
source
share