Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在查看 Akka 源代码。有一种方法可以获取成员的角色 ( .getRoles),但是有没有一种方法可以向现有成员添加新角色?我想使用代码而不是通过配置动态添加它。
.getRoles
不,角色是不可变的,并且在 ActorSystem 启动后无法更改。
您可以在创建 ActorSystem之前以编程方式更改角色,方法是加载配置文件,然后在将配置对象传递给ActorSystem.apply初始引导节点时覆盖角色值。
ActorSystem.apply