How to get object count in S3 bucket for current date using spring-integration-aws?

时间:2018-12-19 11:21:16

标签: spring spring-integration spring-integration-sftp spring-integration-aws

Have a spring integration application where files are routed from a folder to S3 buckets using s3-outbound-channel-adapter. I need to know the number of files/object that are stored under S3 bucket for today's date(current date) and files having format (csv/txt) alone.

Would like to know how to get it using spring-integration-aws without using aws-sdk directly?

Observed that spring-integration-aws has a method in S3session.

@Override
    public S3ObjectSummary[] list(String path) throws IOException {
}

Do we need to use comparator on S3ObjectSummary or is there any other method available to achieve this. Any suggestion is helpful.

1 个答案:

答案 0 :(得分:1)

因此,您使用S3Session.listNames(),然后为所需的文件扩展名过滤结果。

如果您确实需要一些更全面的逻辑,可以考虑使用S3RemoteFileTemplate及其executeWithClient()来访问低级AWS API。