0
votes

I have several remote nodes that stay on different computers and connected in cluster. So, it is logging system on one of the nodes with role 'logging', that write logs in db. I chose to use routing for delivering messages to logger from other nodes. I have one node with main actor and three child actors. Each of them must send logs to logger node. My configuration for router:

akka.actor.deployment {
  /main/loggingRouter = {
    router = adaptive-group
    nr-of-instances = 100
    cluster {
      enabled = on
      routees-path = "/user/loggingEvent"
      use-role = logging
      allow-local-routees = on
    }
  }
  "/main/*/loggingRouter" = {
    router = adaptive-group
    nr-of-instances = 100
    cluster {
      enabled = on
      routees-path = "/user/loggingEvent"
      use-role = logging
      allow-local-routees = on
    }
  }
}

And I create router in each actor with this code

val logging = context.actorOf(FromConfig.props(), name = "loggingRouter")

And send

logging ! LogProtocol("msg")

After that logger receives messages only from one child actor. I don't know how to debug it, but my guess that I apply wrong pattern for this.

What is the best practice for this task? Thx.

Actor from logger node:

system.actorOf(Logging.props(), name = "loggingEvent")
1

1 Answers

0
votes

Problems is in routers with the same names. Ass I see, good pattern is to create one router in main actor and send it to children.