简体   繁体   English

如何在akka.net中修复actor路径

[英]How to fix actor path in akka.net

aktor path = akka://SchedulerAutoAction/user/TaskScheduleraktor
[INFO][7/1/2019 5:22:32 AM][Thread 0007][akka://SchedulerAutoAction/user/TaskScheduleraktor/$a] Message Messages from akka://SchedulerAutoAction/deadLetters to akka://SchedulerAutoAction/user/TaskScheduleraktor/$a was not delivered. 1 dead letters encountered.

As you can see from the logs the actor path and the logs path is different and even at the end of the path theres $a appended. 从日志中可以看到,actor路径和日志路径是不同的,甚至在路径的末尾也附加了$ a。 I want to correct my actor path so this is my akka. 我想纠正演员路径,所以这是我的缺点。

var config = ConfigurationFactory.ParseString(@"configuration {
                akka {
                   io {
                       pinned-dispatcher {
                            type = PinnedDispatcher
                       }
                   }
                }
            }");

            using (_actorSystem = ActorSystem.Create("SchedulerAutoAction", config.GetConfig("configuration")))
            {
                /* create an actor ref */
                _actorRef = _actorSystem.ActorOf(Props.Create<TaskSchedulerAktor>(() => new TaskSchedulerAktor(mongosettings, dbContext))
                             .WithRouter(new RoundRobinPool(2).WithDispatcher("akka.io.pinned-dispathcer")), "TaskScheduleraktor");

                Console.WriteLine($"aktor path = {_actorRef.Path}");

                var delay = TimeSpan.FromMinutes(TaskExecution.task_execution_interval);
                /* schedule repeatedly */
                _actorSystem.Scheduler.ScheduleTellRepeatedly(TimeSpan.FromMinutes(0), delay, _actorRef, new Messages(), ActorRefs.NoSender);
            }

does anyone can help me how can i fixed this? 有谁能帮我解决这个问题?

As described in Akka.NET documentation the way, pool routers are implemented using parent-child hierarchies. Akka.NET文档中所述,池路由器是使用父子层次结构实现的。 When you create an actor configured as a router, in practice you're creating a very lightweight actor (in your case this actor's path is akka://SchedulerAutoAction/user/TaskScheduleraktor ), which underneath keeps a pool of children (routees), to which it forwards received messages. 当您创建一个配置为路由器的角色时,实际上是在创建一个非常轻量的角色(在您的情况下,该角色的路径为akka:// SchedulerAutoAction / user / TaskScheduleraktor ),该角色下方保留了一组子代(路由),它将接收到的消息转发到的位置。 This is how Akka.NET routers deal with concurrency. 这就是Akka.NET路由器处理并发的方式。

Routees are created as an anonymous children of router, therefore their actor path is the same as their parent with autogenerated suffix ( $a , $b , $c etc), which allows to uniquely recognize each routee. 路由是作为路由器的匿名子代创建的,因此其角色路径与带有自动生成的后缀( $ a$ b$ c等)的父代路径相同,从而可以唯一地识别每个路由。

You cannot change actor's path, because it describes exact position of an actor in the hierarchy. 您无法更改角色的路径,因为它描述了角色在层次结构中的确切位置。

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

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