akka.ConfigurationException: Dispatcher [akka.actor.ws-calls-dispatcher] not con figured

While executing the below line:

ExecutionContext executionContext = actorSystem.dispatchers().lookup("akka.actor.ws-calls-dispatcher");

I was getting the below exception:

akka.ConfigurationException: Dispatcher [akka.actor.ws-calls-dispatcher] not configured
    at akka.dispatch.Dispatchers.lookupConfigurator(Dispatchers.scala:97)
    at akka.dispatch.Dispatchers.lookup(Dispatchers.scala:79)
    at schedulers.LogMessageScheduler.start(LogMessageScheduler.java:51)
    at OnStartup.<init>(OnStartup.java:11)
    at OnStartup$$FastClassByGuice$$5603637e.newInstance(<generated>)

But I did configure akka.actor.ws-calls-dispatcher in akka.conf file. Here is config details:

akka {
  actor {
    default-dispatcher {
      fork-join-executor {
        parallelism-min = 8
        parallelism-factor = 3.0
        parallelism-max = 64
        task-peeking-mode = FIFO
      }
    }

    ws-calls-dispatcher {
      type = "Dispatcher"
      executor = "thread-pool-executor"
      thread-pool-executor {
        core-pool-size-min = 8
        core-pool-size-max = 64
        core-pool-size-factor = 3.0
        max-pool-size-min = 100
        max-pool-size-max = 200
        task-queue-size = 20
      }
    }
  }
}

Not sure why the lookup is failing, can someone help me please?

Hi @vg.devalla,

You need to add the configuration in conf/application.conf file instead.

Best.

You can also put include required("akka.conf") in your conf/application.conf file.

Which requires there to be a akka.conf file on the same level as conf/application.conf.

I looked at the documentation, this bit mentions the possibility: https://www.playframework.com/documentation/2.6.x/ConfigFile#Include-semantics:-merging

But without an explicit example.

1 Like

More comprehensive examples can be found here: https://github.com/lightbend/config/blob/master/HOCON.md#includes

:slight_smile: