Nelson
Nelson

Reputation: 3232

How to configure an Akka Router?

When attempting to configure a router I am seeing that I am missing some configuration.

Exception:

Caused by: akka.ConfigurationException: Configuration missing for router [akka://UPS/user/sqs-poller-2/router1] in 'akka.actor.deployment' section.
at akka.routing.FromConfig.verifyConfig(RouterConfig.scala:320)
at akka.routing.RoutedActorRef.<init>(RoutedActorRef.scala:39)
at akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:795)
... 34 common frames omitted

This is what the akka config looks like (in application.conf):

akka {
 actor.deployment {
     /parent/router1 {
       router = round-robin-pool
       nr-of-instances = 4
    }
  }
  loggers = ["akka.event.slf4j.Slf4jLogger"]
  loglevel = "debug"
  logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
  logger-startup-timeout = 30s
}

Scala Code:

val router: ActorRef = context.actorOf(FromConfig.props(SQSPoller.props), "router1")

Does this setup look right? How can I go about figuring out exactly what is missing from the config?

Upvotes: 0

Views: 558

Answers (1)

user5011070
user5011070

Reputation:

According to the error message, you have to provide the following configuration.

   actor.deployment {
       /sqs-poller-2/router1 {
          router = round-robin-pool
          nr-of-instances = 4
       }
    }

In your case, you're creating a router actor within a top level actor named sqs-poller-2, so the deployment path starts with the name of the parent actor followed by the router actor named router1.

Upvotes: 4

Related Questions