i currently work with the S3StreamingMessageSource from spring integration aws. I pass the stream on to an integration flow.
public MessageSource<InputStream> s3InboundStreamingMessageSource() {
S3StreamingMessageSource messageSource = new S3StreamingMessageSource(template());
messageSource.setRemoteDirectory(bucketName);
messageSource.setFilter(new S3PersistentAcceptOnceFileListFilter(new SimpleMetadataStore(),
"streaming"));
return messageSource;
}
@Bean
public IntegrationFlow s3IntegrationFlow() {
return IntegrationFlows.from(s3InboundStreamingMessageSource(), spec -> spec.poller(Pollers.fixedDelay(10, TimeUnit.SECONDS)))
.transform(new S3ObjectInputStreamToStringTransformer())
.transform(Transformers.toJson())
.handle(Http.outboundGateway("http://localhost:8099/create").httpMethod(HttpMethod.POST).extractPayload(true))
.channel("nullChannel")
.get();
}
How can I delete the retrieved remote file from S3?
In the S3InboundFileSynchronizer there is a method for this.
Like this:
@Bean
public S3InboundFileSynchronizer s3InboundFileSynchronizer() {
S3InboundFileSynchronizer synchronizer = new S3InboundFileSynchronizer(factory);
synchronizer.setDeleteRemoteFiles(true);
synchronizer.setPreserveTimestamp(true);
synchronizer.setRemoteDirectory(bucketName);
return synchronizer;
}
Can anyone help me or tell me a good workaround?