Demonstrates usage of AWS SDK's TransferManager for handling S3 uploads.
Notes:
-
the thread-pool given to S3Uploader must be configured for blocking I/O because the
TransferManager
blocks the used threads on uploading chunks, preventing progress in processing the thread-pool's queue -
getting the result in case of errors is problematic, as I found no way to do it without blocking for it and
request.waitForUploadResult
does happen to block the thread, even though you may receive a transfer complete event, but given thatTransferManager
is blocking those threads anyway, I see no harm in that
Configuration lives in application.conf and must be configured with access keys:
aws.s3 {
accessKey = "xxxxx"
secretAccessKey = "xxxxxxxxxxxxxx"
bucketName = "someBucket"
region = "eu-west-1"
}