extractActorSystem

extractActorSystem

Signature

Description

Extracts the ActorSystem from the RequestContext, which can be useful when the external API in your route needs one.

警告

This is only supported when the available Materializer is an ActorMaterializer.

Example

val route = extractActorSystem { actorSystem =>
  complete(s"Actor System extracted, hash=${actorSystem.hashCode()}")
}

// tests:
Get("/") ~> route ~> check {
  responseAs[String] shouldEqual s"Actor System extracted, hash=${system.hashCode()}"
}

Contents