Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import akka.pattern.ask
import akka.pattern.pipe
//case 1:
class ServiceActor extends Actor {
//...
def receive = Receive {
case DoSomeVeryComplexCalculationsRequest(taskDef) =>
(specialAgent ? DoTheMath(taskDef)).mapTo[Option[User]] pipeTo sender
}
//...
def specialAgent = context actorOf SpecialAgent.props
}
// case 2:
class HttpRouteHandlerActor(repository: ActorRef) extends Actor {
//...
def receive = {
case GimmeUser(id) =>
(repository ? GetUserFromRepo(id)).mapTo[Option[User]] pipeTo sender
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.