Last active
December 31, 2015 22:09
-
-
Save longcao/8051452 to your computer and use it in GitHub Desktop.
Client source code.
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._ | |
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://[email protected]: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