Skip to content

Instantly share code, notes, and snippets.

@tstone
Created June 11, 2014 21:01
Show Gist options
  • Save tstone/30e992cb0d2aab84100e to your computer and use it in GitHub Desktop.
Save tstone/30e992cb0d2aab84100e to your computer and use it in GitHub Desktop.
class BadActor extends Actor {
def recieve = {
case Process(id: Int) => process(id)
}
private def process(id: Int) = {
val result = SomeService.get(id)
result onComplete { value =>
sender ! value
}
}
}
class GoodActor extends Actor {
def receive = {
case Process(id: Int) = process(id).map(sender ! _)
}
def process(id: Int): Future[String] =
SomeService.get(id)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment