diff --git a/akka-docs/src/main/paradox/futures.md b/akka-docs/src/main/paradox/futures.md index 664d089640..ba4b851db0 100644 --- a/akka-docs/src/main/paradox/futures.md +++ b/akka-docs/src/main/paradox/futures.md @@ -95,8 +95,8 @@ or a `ClassCastException` if not. Handling `Exception`s will be discussed furthe ## Use the pipe pattern -Another useful message-transfer pattern is "pipe", which is to send the result of `Future` to another actor, upon completion of the `Future`. -The pipe pattern can be used by importing @java[`akka.pattern.PatternsCS.pipe`.]@scala[`akka.pattern.pipe`, and define or import an implicit instance of `ExecutionContext` in the scope. +Another useful message-transfer pattern is "pipe", which is to send the result of @scala[`Future`]@java[`CompletableFuture`] to another actor, upon completion of the @scala[`Future`]@java[`CompletableFuture`]. +The pipe pattern can be used by importing @java[`akka.pattern.PatternsCS.pipe`.]@scala[`akka.pattern.pipe`, and define or import an implicit instance of `ExecutionContext` in the scope.] Scala : @@snip [FutureDocSpec.scala]($code$/scala/docs/future/FutureDocSpec.scala) { #pipe-to-usage } diff --git a/akka-docs/src/test/scala/docs/future/FutureDocSpec.scala b/akka-docs/src/test/scala/docs/future/FutureDocSpec.scala index f30009f7c7..82d5891909 100644 --- a/akka-docs/src/test/scala/docs/future/FutureDocSpec.scala +++ b/akka-docs/src/test/scala/docs/future/FutureDocSpec.scala @@ -38,13 +38,15 @@ object FutureDocSpec { //#pipe-to-usage class ActorUsingPipeTo(target: ActorRef) extends Actor { // akka.pattern.pipe needs to be imported - import akka.pattern.{ask, pipe} + import akka.pattern.{ ask, pipe } // implicit ExecutionContext should be in scope implicit val ec: ExecutionContext = context.dispatcher + implicit val timeout: Timeout = 5.seconds def receive = { - val future = target ? "some message" - future pipeTo sender() // use the pipe pattern + case _ ⇒ + val future = target ? "some message" + future pipeTo sender() // use the pipe pattern } } //#pipe-to-usage