I am looking for solution/example that points me to how to watch multiple SFTP remote directories....
currently using a Spring Boot application with an @Configuration class that watches a single directory as such:
@Bean
public SftpInboundFileSynchronizer sftpInboundFileSynchronizer() throws Exception {
SftpInboundFileSynchronizer fileSynchronizer = new SftpInboundFileSynchronizer(sftpSessionFactory());
fileSynchronizer.setDeleteRemoteFiles(false);
fileSynchronizer.setRemoteDirectory(this.serviceProps.getSftp().getRead().getRemoteDirectory());
fileSynchronizer.setFilter(new SftpSimplePatternFileListFilter(this.serviceProps.getSftp().getRead().getRemotePattern()));
return fileSynchronizer;
}
/**
* Inbound Message Handler for files retrieved from the SFTP server
* @return
* @throws Exception
*/
@Bean
@InboundChannelAdapter(channel = "spn.vendor.gateway.sftp.inbound.channel")
public MessageSource<File> sftpMessageSource() throws Exception {
SftpInboundFileSynchronizingMessageSource source =
new SftpInboundFileSynchronizingMessageSource(sftpInboundFileSynchronizer());
source.setLocalDirectory(new File(this.serviceProps.getSftp().getRead().getLocalDirectory()));
source.setAutoCreateLocalDirectory(true);
FileSystemPersistentAcceptOnceFileListFilter localFilter = new FileSystemPersistentAcceptOnceFileListFilter(new RedisMetadataStore(this.redis), "spn-vendor-gateway-svc");
Collection<FileListFilter<File>> filters = new ArrayList<>();
filters.add(localFilter);
CompositeFileListFilter<File> composite = new CompositeFileListFilter<File>(filters);
source.setLocalFilter(composite); // TODO - need to use persistent a distributed Redis AcceptOnceFileFilter...
return source;
}
I do not see a way to instantiate multiple SftpInboundFileSynchronizer and MessageSource<File> instances all tied to the same input channel using the @Bean annotations.
Thanks for any help that can be given on this.
Mark
I am looking for solution/example that points me to how to watch multiple SFTP remote directories....
currently using a Spring Boot application with an
@Configurationclass that watches a single directory as such:I do not see a way to instantiate multiple
SftpInboundFileSynchronizerandMessageSource<File>instances all tied to the same input channel using the@Beanannotations.Thanks for any help that can be given on this.
Mark