Skip to content

Instantly share code, notes, and snippets.

@freekh
Created January 11, 2012 13:00
Show Gist options
  • Save freekh/1594549 to your computer and use it in GitHub Desktop.
Save freekh/1594549 to your computer and use it in GitHub Desktop.
First Akka actor
//your first actor
class MyActor extends akka.actor.Actor {
def receive = { //when a message is received...
case m =>println(m.toString) //...print it out
}
}
val actorRef = akka.actor.Actor.actorOf[MyActor].start() //start the actor
actorRef ! "Congratulations from your first Akka actor" //send a message
actorRef ! akka.actor.PoisonPill //the actor will stop when this message is received
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment