Asynchronous amazon glacier download

ぃ、小莉子 提交于 2019-12-25 06:55:20

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/22451833/asynchronous-amazon-glacier-download

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!