Last active
March 31, 2016 07:25
Revisions
-
langley renamed this gist
Dec 22, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
langley created this gist
Dec 22, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import akka.actor._ // need an actor system, make it implicit to it's used by all our repl based actors implicit val system = ActorSystem("replActorSystem") // this gives us an easy way to define simple actors import ActorDSL._ // here's a simple example of creating an actor // Also, this will give us a simple actor that is used to print the // results sent back to us from the other actors. implicit val sender = actor(new Act { become { case msg => println(msg) } } ) // Another actor to talk to val anotherActor = actor(new Act { become { case msg => sender ! s"I heard you say: $msg" }}) // Now send the other actor something anotherActor ! "a simple string message" // And you'll see the below, shown in a comment so you can copy & paste all of this into your repl window // scala> I heard you say: a simple string message // Note you see the response because of our implicit sender defined above.