1

Using Play! with CompletionStages, you can supply the an HTTP context like this:

CompletableFuture.supplyAsync(() -> {
doSomething();
}
, context);

Since Play! is based on Akka, you can supply an Akka Dispatcher the same way:

return CompletableFuture.supplyAsync(() -> {
doSomething();
}
, context);

But I have to supply both to the same CompoletionStage. I didn't find any documentation about this specific case. Play! provides an Akka Dispatcher by default, but I have to use my own dispatcher and even to switch between multiple dispatchers in runtime, so I have to either supply both contexts or tell the current HttpExecutionContext to use my dispatcher instead of Play!s default one. Any ideas?

4

0 回答 0