Skip to content

Instantly share code, notes, and snippets.

@kiritsuku
Created July 11, 2011 22:41
Show Gist options
  • Save kiritsuku/1076970 to your computer and use it in GitHub Desktop.
Save kiritsuku/1076970 to your computer and use it in GitHub Desktop.
akka-actor based object orientated HelloWorld in Scala
import akka.actor.Actor
import akka.actor.Actor.actorOf
object HelloWorld extends App {
val a = actorOf[Hello]
a.start()
val resp = (a !! World) getOrElse sys.error("no response")
a.stop()
println(resp)
}
trait Message
case object World extends Message
class Hello extends Actor {
def receive = {
case World => self reply "Hello "+World
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment