4

I'm using Akka 2.2-RC1 and I'm not able to get Akka to load dispatcher configuration from application.conf:

my-dispatcher {
  type = PinnedDispatcher
  executor = "thread-pool-executor"
}

akka.actor.deployment {
  /test {
    dispatcher = my-dispatcher
  }
}

When instantiated from code like

 val test = system.actorOf(Props[Test], "test")

by logs it is still using akka.actor.default-dispatcher.

When I'm adding .withDispatcher("my-dispatcher") to Props all is working properly and my-dispatcher is used. But I do not like idea of adding .withDispatcher(...) to all my actors...

Do anyone know where could be a problem? I was thinking that actor path may be wrong, but apllication.conf routing configuration works properly (with exception of custom routee dispatcher, again).


After some testing I've found that this effect is caused by use of RemoteActorRefProvider. As soon as I disabled it and changed to default

akka.actor.provider = "akka.actor.LocalActorRefProvider"

dispatchers were configuring from config properly.

I guess with remoting enabled Akka looks elsewhere for configuration of actor dispatchers or maybe remote refs have different logical paths?

Seigert
  • 311
  • 3
  • 11

1 Answers1

6

This worked fine for me on the same version of akka that you were using. My config:

test{
  my-dispatcher {
    type = PinnedDispatcher
    executor = "thread-pool-executor"
  }

  akka.actor.deployment {
    /test-actor {
      dispatcher = my-dispatcher
    }
  }
}

My code:

object ActorTest{
  def main(args: Array[String]) {
    val conf = ConfigFactory.load()
    val system = ActorSystem("test", conf.getConfig("test"))
    val ref = system.actorOf(Props[TestActor], "test-actor")
  }
}

class TestActor extends Actor{
  def receive = {
    case _ =>
  }
}

I used jconsole and shows that the pinned dispatcher was listed under the Threads tab

cmbaxter
  • 35,283
  • 4
  • 86
  • 95
  • Thanks for info, with "test" sub-config it really works. But as soon as I move dispatcher and deployment configuration back to 'root' -- it stops working. – Seigert Jun 14 '13 at 06:16
  • I've found that problem is caused by `akka.remote.RemoteActorRefProvider` -- when disabled all is working properly. – Seigert Jun 14 '13 at 07:10
  • This sounds like a bug, would you mind opening a ticket at our assembla tracker? Thanks! – Roland Kuhn Jun 14 '13 at 12:18
  • @Seigert, will you take care of opening the bug as you are the one who found it? – cmbaxter Jun 14 '13 at 12:33
  • Bug report is here: https://www.assembla.com/spaces/akka/tickets/3445#/activity/ticket: – rintcius Dec 09 '13 at 16:15