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
import akka.actor.ActorDSL._ | |
val ref = actor("fred")(new Act { | |
become { | |
case "hello" => sender ! "world!" | |
} | |
}) | |
implicit val recv = inbox() | |
ref ! "hello" // uses the `recv` as sender ref |
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
/** | |
* Copyright (C) 2012 Typesafe Inc. <http://www.typesafe.com> | |
*/ | |
package docs.testkit; | |
import org.junit.AfterClass; | |
import org.junit.Assert; | |
import org.junit.BeforeClass; | |
import org.junit.Test; |
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
set resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/" | |
set libraryDependencies ++= Seq("com.typesafe.akka" % "akka-actor" % "2.0.1", "com.typesafe.akka" % "akka-remote" % "2.0.1", "com.typesafe.akka" % "akka-testkit" % "2.0.1" % "test", "org.specs2" %% "specs2" % "1.9" % "test", "junit" % "junit" % "4.5" % "test") |
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
import sbt._ | |
import Keys._ | |
import classpath.ClasspathUtilities.isArchive | |
import java.io.FileOutputStream | |
import sbtassembly.Plugin._ | |
import AssemblyKeys._ | |
object B extends Build { | |
lazy val merge = TaskKey[File]("merge-reference", | |
"merge all reference.conf") |
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 typedactordemo | |
import akka.actor._ | |
import akka.dispatch.Future | |
import akka.pattern.ask | |
import akka.util.Timeout | |
import akka.util.duration._ | |
case class Request(payload: String) | |
case class Response(payload: String) |
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
import akka.dispatch.Future | |
import akka.pattern.pipe | |
import akka.actor.Actor | |
case class Work(s: String) | |
case class Result(s: String) | |
object MyActor { | |
// put here to avoid closing over actor’s state | |
def doWork(work: String): String = { |
NewerOlder