Last active
July 9, 2016 10:34
-
-
Save Krasnyanskiy/502a6adc8966e9553f5a74e1bf0617e5 to your computer and use it in GitHub Desktop.
-scala: akka: PF.empty test
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
import akka.actor.{Actor, ActorSystem, Props} | |
import akka.util.Timeout | |
import akka.pattern.ask | |
import scala.concurrent.duration._ | |
implicit val timeout = Timeout(2.seconds) | |
class Loafer extends Actor { | |
// def receive = PartialFunction.empty | |
def receive = { | |
case _ => sender ! "oh, I have a story!" | |
} | |
} | |
val slackie = ActorSystem("Slackie") | |
val lf = slackie.actorOf(Props[Loafer], "loafer") | |
val answer = Await.result( | |
lf ? "What's up, loafer?", 2.seconds | |
).asInstanceOf[String] | |
println(answer) | |
slackie shutdown() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment