Last active
August 29, 2015 14:24
-
-
Save johnykov/9a49aa850a1ddb8efe4c to your computer and use it in GitHub Desktop.
ActorDSL helps to provision actor to test in repl. For this example to work you need `build.sbt` file with akka dependency as stated here http://doc.akka.io/docs/akka/snapshot/intro/getting-started.html and type `sbt console` in same directory.
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 characters
import akka.actor.ActorDSL._ | |
import akka.actor.ActorSystem | |
// need an actor system, make it implicit to it's used by all our repl based actors | |
implicit val system = ActorSystem("demo") | |
// 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. | |
val a = actor(new Act { | |
become { | |
case msg => println(msg) | |
} | |
}) | |
// Now send the other actor something | |
a ! "hi" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment