3
votes

I have created a file application.conf in src/main/resources that looks like this:

balancing-dispatcher {
  type = BalancingDispatcher
  executor = "thread-pool-executor"
}

There is nothing else in the file.

Upon creating a new Actor (through my test suite using Akka TestKit) that tries to use the dispatcher, I receive this error message:

[WARN] [04/13/2013 21:55:28.007] [default-akka.actor.default-dispatcher-2] [Dispatchers] Dispatcher [balancing-dispatcher] not configured, using default-dispatcher

My program then runs correctly, albeit using only a single thread.

Furthermore, I intend to package my program into a library. The akka docs state this:

If you are writing an Akka application, keep you configuration in application.conf at
the root of the class path. If you are writing an Akka-based library, keep its 
configuration in reference.conf at the root of the JAR file.

I have tried both of these methods so far, but neither has worked.

Any ideas?

1

1 Answers

2
votes

Since your application.conf is not found I can only assume that src/main/resources is not part of your build path (cannot comment further without knowing which tool you use for building).

One small thing: why do you use "thread-pool-executor" in there? We found the default "fork-join-executor" to scale better.

Your comment about the one thread suggests that you are creating just one actor; using a BalancingDispatcher does not automagically create more actors, you will have to tell Akka to do that somehow (e.g. creating multiple instance of that same actor manually or via a Router).

The question of reference.conf vs. application.conf is more one of the nature of the settings. If your library wants to get its own settings from the config, then default values should go into reference.conf; that is the design concept and the reason why this file is always implicitly merged in. Defaults should only be in that file, never in the code.