0

I am having some problems in communicating between actors in Cluster.

My test project has this structure below.

TestJob [C# Console Project]

  • TestJobService.cs
  • TestJobActor

MainProject [C# Console Project] //Note: I configured this service as a seed node. I didn't use lighthouse.

  • MainService
  • JobManagerActor

Note: I don't want to put actors in Shared project or Main project. The actors that are supposed to do a test job should be under "TestJob" project.

I already followed this article http://getakka.net/docs/clustering/cluster-overview and video. I did enable Akka.Cluster based on the article. I am able to run both console projects but when I tried to "tell" from JobManagerActor to TestJobActor, it doesn't work. No error but doesn't work.

I have this config in MainProject.

         actor {
               provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
               deployment {
            /TestJobAActor {
            router = consistent-hashing-group
                            routees.paths = ["/user/TestJobAActor"]
                    virtual-nodes-factor = 8
            cluster {
                   enabled = on
                   max-nr-of-instances-per-node = 2
                   allow-local-routees = off
                   use-role = backend
            }
            }                           
                 }
         }

Here is the code that I use for sending the message.

           var backendRouter = Context.ActorOf(Props.Empty.WithRouter(new ClusterRouterGroup(new ConsistentHashingGroup("/user/TestJobAActor"),new ClusterRouterGroupSettings(10, false, "backend", ImmutableHashSet.Create("/user/TestJobAActor")))));
            backendRouter.Tell("Yo yo!");

What am I missing? Thanks in advance.

Note: My test project with similar structure can be found here https://github.com/michaelsync/APMDemo . (VS2015 project)

One more question: Can we still use the actor selection when using cluster?

            var actorSelection = Context.ActorSelection("akka.tcp://MyBackendProcessingSystem@127.0.0.1:2553/user/BackEndJobAActor"); //This can come from Model
            actorSelection.Tell("Yo yo!");
4

1 回答 1

1

不用担心!

我设法自己修复了它。您可以在我的临时存储库https://github.com/michaelsync/APMDemo/tree/allinoneproject中查看修复。

  1. 问题是我不知道我需要使用 IConsistentHashable 在一致路由中发送消息。我继续发送字符串并且没有工作。

  2. 本地路线已关闭。

于 2015-08-26T15:34:41.313 回答