Skip to content

Instantly share code, notes, and snippets.

@patriknw
Created July 8, 2013 06:55
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 patriknw/5946725 to your computer and use it in GitHub Desktop.
Save patriknw/5946725 to your computer and use it in GitHub Desktop.
Watch ActorSelection spotlight
val selection = context.actorSelection(
"akka.tcp://sys@10.0.0.1:2552/user/world")
selection ! Identify(None)
var ref: ActorRef = _
def receive = {
case ActorIdentity(_, Some(actorRef)) =>
ref = actorRef
context watch ref
case ActorIdentity(_, None) => // not alive
case Terminated(r) if r == ref => // ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment