简体   繁体   English

如何在Akka.NET中使用动态名称远程部署actor

[英]How to remotely deploy actor with dynamic name in Akka.NET

When I look at the samples of the Akka.NET actor remote deployment, it is done via actor system configuration like this: 当我查看Akka.NET actor远程部署的示例时,它通过actor系统配置完成,如下所示:

actor {
    provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
    deployment {
        /MyActor {
            remote = ""akka.tcp://MyActors@127.0.0.1:8091""
        }
    }
}

The string "MyActor" above is the actual actor name. 上面的字符串“MyActor”是实际的actor名称。 It is not clear to me how would I deploy an actor that would have dynamic name (eg "MyActor:{UID}") or deploy unknown number of actors remotely? 我不清楚如何部署一个具有动态名称的actor(例如“MyActor:{UID}”)或远程部署未知数量的actor? Is there a way to dynamically configure deployment options via code? 有没有办法通过代码动态配置部署选项? It seems a bit tedious and very limited to specify all the remotely deployable actor names in the configuration. 在配置中指定所有可远程部署的actor名称似乎有点乏味且非常有限。

您可以使用actor的Props设置部署选项,例如: Props.Create(() => new MyActor).WithDeploy(new Deploy(new RemoteScope("akka.tcp://remote-system-name@ip:port/")))

我想到的一个解决方法是远程部署一个固定名称管理员角色,并将其用作“代理”来创建并可能与所有其他动态命名的子角色进行通信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM