Skip to content

Instantly share code, notes, and snippets.

@chbatey
Created February 5, 2014 22:25
Show Gist options
  • Save chbatey/8834575 to your computer and use it in GitHub Desktop.
Save chbatey/8834575 to your computer and use it in GitHub Desktop.
Akka: Example parent sending message to child
class ParentActor extends Actor {
def receive: Actor.Receive = {
case msg @ _ => {
println(s"Received msg, delegating work to a child actor")
val childActor = context.actorOf(Props[ChildActor])
childActor ! "Go and do something important!"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment