Renamed more things to SupervisorStrategy. Updated more docs. See #1711
This commit is contained in:
parent
66e0a7cf0b
commit
9e15d2062b
19 changed files with 166 additions and 148 deletions
|
|
@ -154,6 +154,7 @@ In addition, it offers:
|
|||
|
||||
* :obj:`self` reference to the :class:`ActorRef` of the actor
|
||||
* :obj:`sender` reference sender Actor of the last received message, typically used as described in :ref:`Actor.Reply`
|
||||
* :obj:`supervisorStrategy` user overridable definition the strategy to use for supervising child actors
|
||||
* :obj:`context` exposes contextual information for the actor and the current message, such as:
|
||||
|
||||
* factory methods to create child actors (:meth:`actorOf`)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ object FaultHandlingDocSpec {
|
|||
class Supervisor extends Actor {
|
||||
//#strategy
|
||||
import akka.actor.OneForOneStrategy
|
||||
import akka.actor.FaultHandlingStrategy._
|
||||
import akka.actor.SupervisorStrategy._
|
||||
|
||||
override val supervisorStrategy = OneForOneStrategy({
|
||||
case _: ArithmeticException ⇒ Resume
|
||||
|
|
@ -39,7 +39,7 @@ object FaultHandlingDocSpec {
|
|||
class Supervisor2 extends Actor {
|
||||
//#strategy2
|
||||
import akka.actor.OneForOneStrategy
|
||||
import akka.actor.FaultHandlingStrategy._
|
||||
import akka.actor.SupervisorStrategy._
|
||||
|
||||
override val supervisorStrategy = OneForOneStrategy({
|
||||
case _: ArithmeticException ⇒ Resume
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
.. _fault-tolerance-scala:
|
||||
|
||||
Fault Handling Strategies (Scala)
|
||||
=================================
|
||||
Fault Tolerance (Scala)
|
||||
=======================
|
||||
|
||||
.. sidebar:: Contents
|
||||
|
||||
|
|
@ -12,8 +12,8 @@ children, and as such each actor defines fault handling supervisor strategy.
|
|||
This strategy cannot be changed afterwards as it is an integral part of the
|
||||
actor system’s structure.
|
||||
|
||||
Creating a Fault Handling Strategy
|
||||
----------------------------------
|
||||
Creating a Supervisor Strategy
|
||||
------------------------------
|
||||
|
||||
For the sake of demonstration let us consider the following strategy:
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ it's located in ``akka.actor.TypedActor``.
|
|||
:include: typed-actor-extension-tools
|
||||
|
||||
.. warning::
|
||||
|
||||
|
||||
Same as not exposing ``this`` of an Akka Actor, it's important not to expose ``this`` of a Typed Actor,
|
||||
instead you should pass the external proxy reference, which is obtained from within your Typed Actor as
|
||||
``TypedActor.self``, this is your external identity, as the ``ActorRef`` is the external identity of
|
||||
|
|
@ -127,7 +127,7 @@ Request-reply-with-future message send
|
|||
.. includecode:: code/akka/docs/actor/TypedActorDocSpec.scala
|
||||
:include: typed-actor-call-future
|
||||
|
||||
This call is asynchronous, and the Future returned can be used for asynchronous composition.
|
||||
This call is asynchronous, and the Future returned can be used for asynchronous composition.
|
||||
|
||||
Stopping Typed Actors
|
||||
---------------------
|
||||
|
|
@ -153,6 +153,13 @@ you can create child Typed Actors by invoking ``typedActorOf(..)`` on that.
|
|||
|
||||
This also works for creating child Typed Actors in regular Akka Actors.
|
||||
|
||||
Supervisor Strategy
|
||||
-------------------
|
||||
|
||||
By having your Typed Actor implementation class implement ``TypedActor.Supervisor``
|
||||
you can define the strategy to use for supervising child actors, as described in
|
||||
:ref:`supervision` and :ref:`fault-tolerance-scala`.
|
||||
|
||||
Lifecycle callbacks
|
||||
-------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue