extractExecutionContext
Description
Extracts the ExecutionContext
from the RequestContext
.
See withExecutionContext to see how to customise the execution context provided for an inner route.
See extract to learn more about how extractions work.
Example
final Route route = path("sample", () ->
extractExecutionContext(executor ->
onSuccess(() ->
CompletableFuture.supplyAsync(
// uses the `executor` ExecutionContext
() -> "Run on " + executor.hashCode() + "!", executor
), str -> complete(str)
)
)
);
// tests:
testRoute(route).run(HttpRequest.GET("/sample"))
.assertEntity("Run on " + system().dispatcher().hashCode() + "!");