Akka actor lookup or dependency injection

懵懂的女人 提交于 2020-01-02 02:32:09

问题


I'm just starting to work with Akka and I can't decide if I should use dependency injection (like cake pattern) or actor lookup in order to decouple the actors from each others. What is the preferred method?


回答1:


You should prefer to introduce actors to each other, which means to send an ActorRef in or with a message or to pass it into a constructor. The latter may involve the cake pattern of you so choose, but lookup is much more expensive and therefore you should use real ActorRef whenever possible.



来源:https://stackoverflow.com/questions/17770900/akka-actor-lookup-or-dependency-injection

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