Created
October 26, 2013 09:50
-
-
Save dosht/7167432 to your computer and use it in GitHub Desktop.
Hello World Example for Akka Actors
This file contains 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 scala.concurrent.duration._ | |
class HelloActor extends Actor { | |
def receive = { | |
case "exit" => context.system.shutdown() | |
case message => println(message) | |
} | |
} | |
object Hello extends App { | |
val system = ActorSystem("HelloWorld") | |
val helloActor = system.actorOf(Props[HelloActor], name = "hello-actor") | |
helloActor ! "hi actor" | |
helloActor ! "exit" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment