0
我正在使用Play 2.3.7,我需要使用控制器內部的Actor。下面的代碼工作正常無法查找自定義調度程序
implicit val system = ActorSystem()
implicit val dispatcher = system.dispatcher
val future = (IO(Http) ? Get(url).withHeaders(...).mapTo[HttpResponse]
val result = Await.results(future, Duration.Inf)
現在我做如下改變我conf/application.conf
play {
akka {
actor {
default-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
fixed-pool-size = 128
}
}
foo-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
fixed-pool-size = 128
}
}
}
}
}
而現在,我的代碼更改爲
implicit val system = ActorSystem()
implicit val dispatcher = system.dispatchers.lookup("foo-dispatcher")
val future = (IO(Http) ? Get(url).withHeaders(...).mapTo[HttpResponse]
val result = Await.results(future, Duration.Inf)
我得到一個異常有消息[foo-dispatcher] not configured