Created
April 29, 2012 09:32
-
-
Save andreaskallberg/2549021 to your computer and use it in GitHub Desktop.
Scala akka simple app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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