Created
January 24, 2017 16:19
-
-
Save chris-martin/dfd2a6846b86448e469f5f4e254f5dd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Question[R] { | |
def ask(ref: ActorRef)(implicit timeout: Timeout, ct: ClassTag[R]): | |
Future[R] = | |
new AskableActorRef(ref).ask(this).mapTo[R] | |
def reply(r: R)(implicit context: ActorContext): Unit = | |
context.sender ! r | |
def replyWithFuture(f: Future[R]) | |
(implicit ac: ActorContext, ec: ExecutionContext): Unit = { | |
val _ = f.pipeTo(ac.sender) | |
() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment