admin管理员组

文章数量:1399986

In the AWS SDK v1, it was possible to add a ProgressListener directly to a MultipleFileUpload object and set up logging in the progressedChanged method so that the progress of a directory upload could be logged periodically as it was running. I am looking for an equivalent to this behavior in v2.

I see that there are TransferListeners in v2 which are associated with single file uploads and downloads. These can be set up for an UploadDirectoryRequest by doing something like the following:

UploadDirectoryRequest.builder()
   .uploadFileRequestTransformer((request) -> {
      request.addTransferListener(LoggingTransferListener.create());
   })
   .build();

But this would make a listener per file upload request and in order to log out the progress of a directory upload, it would be necessary to keep track of all of the listeners created for each file and sum the bytes transferred in each. It seems like there should be a way to do this more simply that I have not figured out. Is there a more efficient way?

本文标签: