extractActorSystem

Description

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

Warning

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

Example

final Route route = extractActorSystem(actorSystem ->
  complete("Actor System extracted, hash=" + actorSystem.hashCode())
);

// tests:
testRoute(route).run(HttpRequest.GET("/"))
  .assertEntity("Actor System extracted, hash=" + system().hashCode());
The source code for this page can be found here.