An ActorRef is an actor’s address: it identifies the actor and is the handle used to send it messages, rather than exposing the actor itself. An ActorSystem returns an ActorRef for a top-level actor, which keeps the communication model suitable whether that actor runs nearby or on another server. section 1.7.1
Send messages to an ActorRef, not directly to actor code. The reference places incoming messages in the actor’s mailbox, where they wait for processing one at a time in arrival order. This separates message senders from the actor’s processing work. section 1.7.2
Use the mailbox diagram to trace the path from a sender’s ActorRef message to queued, sequential actor processing. section 1.7.2
Actor references support several practical design needs:
- Locate actors by ActorPath. Actor names are unique among siblings, and paths can be absolute or relative. section 1.7.1
- Keep application code unchanged while moving communication from local actors to remote actors; configure how remote references are resolved. section 1.7.4
- Avoid direct object coupling in fault-prone processing pipelines, allowing actor lifecycle handling to remain separate from functional work. section 5.1.1
Scaling a conversation service
A conversation component can send messages through references without caring whether a collaborating component is local or remote. The same message-based structure also lets a supervisor communicate with components when failures require monitoring, stopping, or restarting them. section 1.5.4 section 1.7.4
