akka actor如何彙總結果?
作者:由 夏梓耀 發表于 歷史時間:2015-12-25
1。 主從方式:存在Master Actor裡,task分發和result彙總都交給Master Actor來做,Worker Actor(子Actor)負責接收任務執行和返回結果,Master 需要mark哪些Worker做完了。
2。 Scala Future:直接用?的方式 請求所有子Actor,返回一個Future的List,然後用Future。sequence方法把List[Future[Result]]變成Future[List[Result]]去apply你最終的結果函式,而在何處用?都沒關係。
謝邀