Actor discovery: Don't start a page with referencing and describing h… (#27880)

This commit is contained in:
Helena Edelson 2019-10-04 02:08:34 -07:00 committed by Patrik Nordwall
parent b6a1bd2c9b
commit 11a658deb1
2 changed files with 9 additions and 18 deletions

View file

@ -11,7 +11,7 @@ distributed Akka application.
The above image displays the relationship between the most important entities
within an actor system, please read on for the details.
## What is an Actor Reference?
## What is an Actor Reference
An actor reference is a subtype of `ActorRef`, whose foremost purpose is
to support sending messages to the actor it represents. Each actor has access
@ -113,17 +113,7 @@ You cannot freely create actor paths like symbolic links to refer to arbitrary a
## How are Actor References obtained?
There are two general categories to how actor references may be obtained: by
creating actors or by looking them up through the @ref:[Receptionist](../typed/actor-discovery.md#receptionist).
### Creating Actors
An actor system is started by creating actors beneath the user guardian
actor using the `ActorContext.spawn` method and then using
`ActorContext.spawn` from within the created actors to spawn the actor
tree. These methods return a reference to the newly created actor. Each actor
has direct access (through its `ActorContext`) to references for its parent,
itself and its children. These references may be sent within messages to other actors,
enabling those to reply directly.
@ref:[creating actors](../typed/actor-lifecycle.md#creating-actors) or by looking them up through the @ref:[Receptionist](../typed/actor-discovery.md#receptionist).
## Actor Reference and Path Equality

View file

@ -14,7 +14,10 @@ To use Akka Actor Typed, you must add the following dependency in your project:
version=$akka.version$
}
## Introduction
## Obtaining Actor references
There are two general ways to obtain @ref:[Actor references](../general/addressing.md#what-is-an-actor-reference): by
@ref:[creating actors](actor-lifecycle.md#creating-actors) and by discovery using the @ref:[Receptionist](#receptionist).
You can pass actor references between actors as constructor parameters or part of messages.
@ -24,7 +27,8 @@ applicable.
## Receptionist
For this purpose there is an actor called the `Receptionist`. You register the specific actors that should be discoverable
When an actor needs to be discovered by another actor but you are unable to put a reference to it in an incoming message,
you can use the `Receptionist`. You register the specific actors that should be discoverable
from other nodes in the local `Receptionist` instance. The API of the receptionist is also based on actor messages.
This registry of actor references is then automatically distributed to all other nodes in the cluster.
You can lookup such actors with the key that was used when they were registered. The reply to such a `Find` request is
@ -32,12 +36,9 @@ a `Listing`, which contains a `Set` of actor references that are registered for
registered to the same key.
The registry is dynamic. New actors can be registered during the lifecycle of the system. Entries are removed when
registered actors are stopped or a node is removed from the cluster. To facilitate this dynamic aspect you can also subscribe
registered actors are stopped or a node is removed from the @ref:[Cluster](cluster.md). To facilitate this dynamic aspect you can also subscribe
to changes with the `Receptionist.Subscribe` message. It will send `Listing` messages to the subscriber when entries for a key are changed.
The primary scenario for using the receptionist is when an actor needs to be discovered by another actor but you are unable
to put a reference to it in an incoming message.
These imports are used in the following example:
Scala