Spring Batch - Read files from Aws S3

后端 未结 3 1900
萌比男神i
萌比男神i 2021-01-05 07:09

I am trying to read files from AWS S3 and process it with Spring Batch:

Can a Spring Itemreader process this Task? If so, How do I pass the credentials to S3 client

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-05 07:31

    Another way to read from S3 through FlatFileItemReader is to set Resouce as InputStream Resouce and then use s3client putobject to upload the Stream.

    reader.setResource(new InputStreamResouce(inputstream));
    

    Once the stream is populated,

    s3client.putObject(bucketname,key,inputstream,metadata);
    

提交回复
热议问题