Skip to content

Instantly share code, notes, and snippets.

@andreaskallberg
Created April 29, 2012 09:32
Show Gist options
  • Save andreaskallberg/2549021 to your computer and use it in GitHub Desktop.
Save andreaskallberg/2549021 to your computer and use it in GitHub Desktop.
Scala akka simple app
package org.foo.simple
import akka.actor.{ ActorSystem, Actor, Props }
case class Message(who: String)
class FirstActor extends Actor {
val second = context.actorOf(Props[SecondActor], name = "second")
def receive = {
case Message(who) =>
println("First")
second ! Message(who)
}
}
class SecondActor extends Actor {
def receive = {
case Message(who) => println("Hellooo: " + who)
}
}
object SimpleApp extends App {
val sys = ActorSystem("test")
val first = sys.actorOf(Props[FirstActor], name = "first")
first ! Message("Kaiyser Söze")
sys.awaitTermination()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment