我从以下帖子中获得了以下示例:
http://blog.tksfz.org/2012/10/12/websockets-echo-using-play-scala-and-actors-part-i/
import play.api.libs.concurrent.Akka
import play.api.Play.current // needed by Akka.future
def simpleAsyncWebSocket = WebSocket.async[String] {
Akka.future {
val out = Enumerator.imperative[String]()
val in = Iteratee.foreach[String] {
msg =>
out.push(msg)
}
(in, out)
}
}
这里的问题是上面的代码将使用哪个执行上下文?我尝试在我的 Play 应用程序中使用它。Hers 是我为默认执行上下文配置的:
play {
akka {
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
loglevel = WARNING
actor {
default-dispatcher = {
fork-join-executor {
parallelism-factor = 3.0
parallelism-max = 256
}
}
}
}
}
如何将自定义执行上下文附加到上面的示例代码?