Akka and ReactiveMongo

前端 未结 2 898
挽巷
挽巷 2021-02-03 12:02

I am trying to find the best approach to sharing the same pool of connection between actors withing the cluster workers. I have the following structure:

Master Actor ->

2条回答
  •  感动是毒
    2021-02-03 12:22

    The answer by cmbaxter works as long as you don't need to instantiate the worker actors remotely. MongoConnection is not serializable.

    I found this article https://github.com/eigengo/akka-patterns/wiki/Configuration very helpful. The basic idea is to implement a trait called Configured, which is populated by the main application. The actors can then use that trait to gain access to local, non-serializable objects such as MongoConnection.

提交回复
热议问题