这是我见过的两种用法:
context.actorOf(Props(new IndexWorker(props)).withRouter(RoundRobinRouter(4)))
context.actorOf(RoundRobinPool(4).props(Props[FileExplorer]))
这两种用法有什么区别?
最佳答案
RoundRobinRouter
已弃用
@deprecated("Use RoundRobinPool or RoundRobinGroup", "2.3")
在akka documentation中有一个关于路由器差异的部分。 :
This type of router actor comes in two distinct flavors:
Pool - The router creates routees as child actors and removes them from the router if they terminate.
Group - The routee actors are created externally to the router and the router sends messages to the specified path using actor selection, without watching for termination.
关于scala - RoundRobinPool 和 RoundRobinRouter 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35262653/