HOCON format for cluster router group?

I have installed one Akka.Net node as a seed node in the cluster which I call frontend and another node which I call backend. In the node frontend, I set up the cluster cluster group in code, which allows me to send messages from the frontend to any nodes connecting to the backend role (in a circular fashion) and that have an actor in / user / backend. The code I have is as follows:

system.ActorOf(Props.Empty.WithRouter(
    new ClusterRouterGroup(
        new RoundRobinGroup("/user/backend"),
        new ClusterRouterGroupSettings(10, false, "backend", ImmutableHashSet.Create("/user/backend"))
)));

      

Now I want to move this configuration into a config file (hocon). How do I do this so that I only need the following code to generate it?

system.ActorOf(Props.Empty.WithRouter(FromConfig.Instance), "backend");

      

My attempt only gave exceptions with no clues.

/backend {
  router = round-robin-group
  routees.paths = ["/user/backend"]
  cluster {
    enabled = on
    max-nr-of-instances-per-node = 1
    allow-local-routees = off
    use-role = backend
  }
}

      

Any good hints? The only information I get in the exception is:

Configuration problem while creating [akka://ClusterSystem/user/backend] with router dispatcher [akka.actor.default-dispatcher] and mailbox  and routee dispatcher [akka.actor.default-dispatcher] and mailbox [].

      

+3


source to share


1 answer


It's hard to tell without seeing the full configuration of HOCON. It looks like you just need a cluster router. Nothing obvious jumps out at me, but here are a few things that come to my mind when I start looking:

  • Have you specified your seed node? frontend

    needed as a seed node. It will "merge" to start the cluster.
  • Double check that you have all the required items for Akka.Cluster

    HOCON, including specifying sections Akka.Cluster

    and akka.remote

    HOCON.
  • The configuration for /backend

    is in the correct HOCON section? You must be in akka.actor.deployment

    .
  • For a multicast router, you don't need a flag max-nr-of-instances-per-node

    . This is for bullet routers to limit the number of routes they deploy to a given node in the cluster.


Here is an example config that should work for frontend

node based on what I can see. But it would be helpful if you could add your full HOCON.

akka {
    actor {
        provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
        deployment {
            /backend {
                router = broadcast-group
                routees.paths = ["/user/backend"]
                cluster {
                  enabled = on
                  allow-local-routees = on
                  use-role = backend
                  }
                }
        }
    }

    remote {
        log-remote-lifecycle-events = DEBUG
        helios.tcp {
          hostname = "127.0.0.1"
          port = 0
        }
    }

    cluster {
      seed-nodes = ["akka.tcp://ActorSystem@127.0.0.1:1234"] # specify your full frontend seed node address here
      roles = ["frontend"]
      auto-down-unreachable-after = 30s
    }
}

      

+4


source







All Articles