Skip to content

Instantly share code, notes, and snippets.

@dosht
Created October 26, 2013 09:50
Show Gist options
  • Save dosht/7167432 to your computer and use it in GitHub Desktop.
Save dosht/7167432 to your computer and use it in GitHub Desktop.
Hello World Example for Akka Actors
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