简体   繁体   中英

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. 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. 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. This is how Akka.NET routers deal with concurrency.

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.

You cannot change actor's path, because it describes exact position of an actor in the hierarchy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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