Question

I want to asynchronously download multiple glacier files using thread pool. My current approach uses High Level API for Glacier download, but every thread waits at download method until the download job is complete. Below is the code where all the treads are waiting

            ArchiveTransferManager manager = new     ArchiveTransferManager(Amazon.RegionEndpoint.USEast1);
            DownloadOptions options = new DownloadOptions();
            manager.Download(vaultName, archiveId, downloadFilePath, options); 

Can somebody please suggest me how to download archive asynchronously, so that my thread should come back after getting the job id and some event should get raised on download completion.

Regards, Haseena

Was it helpful?

Solution

If Amazon doesn't offer an asynchronous API, you'll need to implement one yourself. You already have a thread for each download, just have your download thread notify your main thread when the download is done.

TPL can help you do that automatically - create a Task that downloads a file, and await on it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top