Skip to content

Instantly share code, notes, and snippets.

@patriknw
Created July 8, 2013 06:55
Show Gist options
  • 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://[email protected]: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