Skip to content

Instantly share code, notes, and snippets.

@longcao
Last active December 31, 2015 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save longcao/8051452 to your computer and use it in GitHub Desktop.
Save longcao/8051452 to your computer and use it in GitHub Desktop.
Client source code.
import akka.actor._
object Client extends App {
val system = ActorSystem("clientSystem")
val clientActor = system.actorOf(Props(new ClientActor), name = "ClientActor")
clientActor ! SayHello
}
class ClientActor extends Actor {
private val server = context.actorSelection("akka.tcp://serverSystem@127.0.0.1:2552/user/ServerActor")
def receive = {
case SayHello => server ! "Hello."
case message: String => println("Client received reply: " + message)
case _ => println("I got something I didn't understand.")
}
}
case object SayHello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment