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