I was using the sample configuration from https://github.com/spring-projects/spring-integration-aws for an Inbound Channel Adapter, but I have a bucket that will contain subdirectories with CSV's inside.
Is there a way to replicate locally the bucket tree structure? I have only managed to copy the files from inside the subdirs, but they end up being created right in the root of the directory that I set with messageSource.setLocalDirectory(LOCAL_FOLDER);
Or is there a way to identify what bucket subdir the file came from?
@Bean
@InboundChannelAdapter(value = "s3FilesChannel", poller = @Poller(fixedDelay = "100"))
public S3InboundFileSynchronizingMessageSource s3InboundFileSynchronizingMessageSource() {
S3InboundFileSynchronizingMessageSource messageSource =
new S3InboundFileSynchronizingMessageSource(s3InboundFileSynchronizer());
messageSource.setAutoCreateLocalDirectory(true);
messageSource.setLocalDirectory(LOCAL_FOLDER);
messageSource.setLocalFilter(new AcceptOnceFileListFilter<File>());
return messageSource;
}
You need to use
And specify a
RecursiveDirectoryScanner
: https://docs.spring.io/spring-integration/docs/current/reference/html/ftp.html#_recovering_from_failures:You need to pull from bucket and the
S3InboundFileSynchronizingMessageSource
will restore a structure in the local dir.Note: you need to use, of course, the latest
spring-integration-aws-2.0.0.RELEASE
.