extractExecutionContext
シグネチャ
説明
`` RequestContext``から `` ExecutionContext``を抽出します。
:ref:`-withExecutionContext`を参照して、内部ルートに提供される実行コンテキストをカスタマイズする方法を参照してください。
例
def sample() =
  path("sample") {
    extractExecutionContext { implicit executor =>
      complete {
        Future(s"Run on ${executor.##}!") // uses the `executor` ExecutionContext
      }
    }
  }
val route =
  pathPrefix("special") {
    sample() // default execution context will be used
  }
// tests:
Get("/sample") ~> route ~> check {
  responseAs[String] shouldEqual s"Run on ${system.dispatcher.##}!"
}
Contents