Akka Actors: Need an example to understand some basics

前端 未结 2 1080
我寻月下人不归
我寻月下人不归 2021-01-31 21:10

I\'m tinkering with Akka and need some advice how to implement something specific i have in mind. I want to have an actor which i can send a DownloadFile(URI, File)

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 21:52

    Create a DownloadActor class that manages the downloads, Have all DownloadActors share the same Dispatcher, Configure the Dispatcher according to your needs (max num threads, queue size etc), Have all DownloadActors linked to the same Supervisor, Configure the Supervisor according to your needs (probably OneForOneStrategy), Create a new DownloadActor for each new Download or use a LoadBalancer with an appropriate InfiniteIterator to distribute the downloads to the DownloadActors.

    If you use AsycHttpClient to download the files, it supports download-resume.

提交回复
热议问题