add more information about supervisor strategies
This commit is contained in:
parent
ff6a76f375
commit
da00a91b34
4 changed files with 44 additions and 3 deletions
|
|
@ -68,6 +68,8 @@ An actor system will during its creation start at least three actors, shown in
|
|||
the image above. For more information about the consequences for actor paths
|
||||
see :ref:`toplevel-paths`.
|
||||
|
||||
.. _user-guardian:
|
||||
|
||||
``/user``: The Guardian Actor
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
@ -89,7 +91,7 @@ will shut down the whole actor system.
|
|||
This special guardian has been introduced in order to achieve an orderly
|
||||
shut-down sequence where logging remains active while all normal actors
|
||||
terminate, even though logging itself is implemented using actors. This is
|
||||
realized by having the system guardian watch the guardian and initiate its own
|
||||
realized by having the system guardian watch the user guardian and initiate its own
|
||||
shut-down upon reception of the :class:`Terminated` message. The top-level
|
||||
system actors are supervised using a strategy which will restart indefinitely
|
||||
upon all types of :class:`Exception` except for
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ does not apply, leaving the possibility to specify an absolute upper limit on th
|
|||
restarts or to make the restarts work infinitely.
|
||||
|
||||
Default Supervisor Strategy
|
||||
---------------------------
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
``Escalate`` is used if the defined strategy doesn't cover the exception that was thrown.
|
||||
|
||||
|
|
@ -64,6 +64,24 @@ exceptions are handled by default:
|
|||
If the exception escalate all the way up to the root guardian it will handle it
|
||||
in the same way as the default strategy defined above.
|
||||
|
||||
Stopping Supervisor Strategy
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Closer to the Erlang way is the strategy to just stop children when they fail
|
||||
and then take corrective action in the supervisor when DeathWatch signals the
|
||||
loss of the child. This strategy is also provided pre-packaged as
|
||||
:obj:`SupervisorStrategy.stoppingStrategy` with an accompanying
|
||||
:class:`StoppingSupervisorStrategy` configurator to be used when you want the
|
||||
``"/user"`` guardian to apply it.
|
||||
|
||||
Supervision of Top-Level Actors
|
||||
-------------------------------
|
||||
|
||||
Toplevel actors means those which are created using ``system.actorOf()``, and
|
||||
they are children of the :ref:`User Guardian <user-guardian>`. There are no
|
||||
special rules applied in this case, the guardian simply applies the configured
|
||||
strategy.
|
||||
|
||||
Test Application
|
||||
----------------
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,10 @@ As you can see from the example above the following pattern is used to find an `
|
|||
|
||||
akka://<actorsystemname>@<hostname>:<port>/<actor path>
|
||||
|
||||
Once you obtained a reference to the actor you can interact with it they same way you would with a local actor, e.g.::
|
||||
|
||||
actor.tell("Pretty awesome feature", getSelf());
|
||||
|
||||
.. note::
|
||||
|
||||
For more details on how actor addresses and paths are formed and used, please refer to :ref:`addressing`.
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ which is a ``PartialFunction[Throwable, Directive]``. This
|
|||
is the piece which maps child failure types to their corresponding directives.
|
||||
|
||||
Default Supervisor Strategy
|
||||
---------------------------
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
``Escalate`` is used if the defined strategy doesn't cover the exception that was thrown.
|
||||
|
||||
|
|
@ -68,6 +68,23 @@ exceptions are handled by default:
|
|||
If the exception escalate all the way up to the root guardian it will handle it
|
||||
in the same way as the default strategy defined above.
|
||||
|
||||
Stopping Supervisor Strategy
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Closer to the Erlang way is the strategy to just stop children when they fail
|
||||
and then take corrective action in the supervisor when DeathWatch signals the
|
||||
loss of the child. This strategy is also provided pre-packaged as
|
||||
:obj:`SupervisorStrategy.stoppingStrategy` with an accompanying
|
||||
:class:`StoppingSupervisorStrategy` configurator to be used when you want the
|
||||
``"/user"`` guardian to apply it.
|
||||
|
||||
Supervision of Top-Level Actors
|
||||
-------------------------------
|
||||
|
||||
Toplevel actors means those which are created using ``system.actorOf()``, and
|
||||
they are children of the :ref:`User Guardian <user-guardian>`. There are no
|
||||
special rules applied in this case, the guardian simply applies the configured
|
||||
strategy.
|
||||
|
||||
Test Application
|
||||
----------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue