Fix compilation errors and minor update to the futures.md

This commit is contained in:
Richard Imaoka 2018-07-29 00:41:09 +09:00
parent 52864ffb28
commit 8f5ea03a6f
2 changed files with 7 additions and 5 deletions

View file

@ -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