【发布时间】:2017-08-14 22:38:21
【问题描述】:
我使用的是 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 的异常
【问题讨论】:
标签: scala playframework playframework-2.3