2.2 Spotlight: ActorSelection, Watch and Identify

ActorSelection can be used pretty much in the same way as an ActorRef, but DeathWatch must always be done through an ActorRef, because here the incarnation of the actor is important.

To acquire an ActorRef for an ActorSelection you need to send a message to the selection and use the sender reference of the reply from the actor. Alternatively there is a built-in Identify message that all Actors will understand and automatically reply to with a ActorIdentity message containing the ActorRef.

Read more about ActorSelection in docs for Java and docs for Scala.

Recent comments

Blog comments powered by Disqus