1、actorSelection,当涉及actor远程通信时,可以使用actorSelection。
context.actorSelection("akka.tcp://app@otherhost:1234/user/serviceB")
当需要对这个actor进行管理的话,可以通过发送
val identifyId = 1
context.actorSelection("akka.tcp://app@otherhost:1234/user/serviceB") ! Identify(identifyId)
Identify是一个所有actor全都认识且会自动回复的的case class,回复ActorIdentity
case ActorIdentity(`identifyId`, Some(ref)) =>
context.watch(ref)
context.become(active(ref))
case ActorIdentity(`identifyId`, None) => context.stop(self)
原文:http://www.cnblogs.com/ppgeneve/p/6344610.html