我是 Akka 的新手,我正在尝试完成入门系列。我能够配置 Dispatcher,现在我正在尝试配置 PinnedDispatcher。我按照入门页面的指示进行操作,但收到错误消息
[WARN] [06/19/2013 12:53:13.791] [System-akka.actor.default-dispatcher-5] [Dispatchers] Dispatcher [akka.actor.my-pinned-dispatcher] not configured, using default-dispatcher
这是斯卡拉代码:
val system = ActorSystem("System")
val a = system.actorOf(Props[TestActor].withDispatcher("akka.actor.my-pinned-dispatcher")) //this doesnt work
val a = system.actorOf(Props[TestActor].withDispatcher("akka.actor.my-dispatcher")) //this does work
a ! "Hello World"
system.shutdown()
class TestActor extends Actor {
def receive = {
case s: String => println(s)
}
}
这是我的 application.conf
akka {
actor {
my-pinned-dispatcher {
executor = "thread-pool-executor"
type = PinnedDispatcher
}
my-dispatcher {
type = Dispatcher
executor = "fork-join-executor"
fork-join-executor {
parallelism-min = 2
parallelism-factor = 2.0
parallelism-max = 10
}
throughput = 100
}
}
}
我是否错误地配置了 PinnedDispatcher?