Skip to content

Instantly share code, notes, and snippets.

@gaocegege
Forked from crdueck/client.scala
Created March 5, 2016 13:48
Show Gist options
  • Save gaocegege/de13b9b80bb9b36a6a83 to your computer and use it in GitHub Desktop.
Save gaocegege/de13b9b80bb9b36a6a83 to your computer and use it in GitHub Desktop.
akka remote
// client conf
akka {
loglevel = "DEBUG"
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
transport = "akka.remote.netty.NettyRemoteTransport"
log-sent-messages = on
log-received-messages = on
netty {
hostname = "10.224.36.55"
port = 2552
}
}
}
// client code
object Client extends App {
val system = ActorSystem("system")
val master = system.actorSelection("akka://[email protected]:2552/user/master")
val slave = system.actorOf(Props[Slave], "slave")
master.tell(Pong, slave)
system.awaitTermination()
}
// server conf
akka {
loglevel = "DEBUG"
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
transport = "akka.remote.netty.NettyRemoteTransport"
log-sent-messages = on
log-received-messages = on
netty {
hostname = "10.224.19.240"
port = 2552
}
}
}
// server code
object Server extends App {
val system = ActorSystem("system")
val master = system.actorOf(Props[Master], "master")
system.awaitTermination(10 seconds)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment