Search code examples
c#.netakkaakka-remote-actorakka-remoting

Akka.NET Configuration settings for remoting


I am using the example on the Akka.NET github to play with some basic remoting.

In the remoting example available from GitHub there is the following section in the configuration string for Akka.NET.

deployment {
    /localactor {
        router = round-robin-pool
        nr-of-instances = 5
    }
    /remoteactor {
        router = round-robin-pool
        nr-of-instances = 5
        remote = ""akka.tcp://system2@localhost:666""
    }
}
remote {
   dot-netty.tcp {
   port = 1234
   hostname = localhost
}
  1. What does the forward slash / indicate? is this a comment or is this just the format of the files?

  2. What does the router option 'round-robin-pool' control? I can see that it maps to the following class but I am hoping someone can explain what akka.routing actually means in the context of a remoting scenario? I am assuming this has something to do with how urls or ips are mapped?

Any clarification would be appreciated.


Solution

  • Consider the following snippet from the example:

    /localactor {
        router = round-robin-pool
        nr-of-instances = 5
    }
    

    What does the forward slash / indicate? is this a comment or is this just the format of the files?

    The forward slash is not a comment; it indicates the name of an actor. The code in the example refers to the actor named localactor in the following way:

    var local = system.ActorOf(Props.Create(() => new SomeActor("hello", 123)).WithRouter(FromConfig.Instance), "localactor");
    

    What does the router option 'round-robin-pool' control? I can see that it maps to the following class but I am hoping someone can explain what akka.routing actually means in the context of a remoting scenario? I am assuming this has something to do with how urls or ips are mapped?

    round-robin-pool is used to define a router. localactor in the above configuration snippet is a router actor that creates a pool of five routee instances to which it routes messages in round-robin order. A router has no special meaning in a remoting context; it is essentially no different from a router in a non-remoting scenario. You can read more about routers in the linked documentation.