Search Results for

    Show / Hide Table of Contents

    Class AllForOneStrategy

    This class represents a fault handling strategy that applies a Directive to all child actors when one child fails.

    Inheritance
    object
    SupervisorStrategy
    AllForOneStrategy
    Implements
    ISurrogated
    IEquatable<AllForOneStrategy>
    Inherited Members
    SupervisorStrategy.HandleFailure(ActorCell, IActorRef, Exception, ChildRestartStats, IReadOnlyCollection<ChildRestartStats>)
    SupervisorStrategy.DefaultDecider
    SupervisorStrategy.RestartChild(IActorRef, Exception, bool)
    SupervisorStrategy.ResumeChild(IActorRef, Exception)
    SupervisorStrategy.LogFailure(IActorContext, IActorRef, Exception, Directive)
    SupervisorStrategy.LoggingEnabled
    SupervisorStrategy.DefaultStrategy
    SupervisorStrategy.StoppingStrategy
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Actor
    Assembly: Akka.dll
    Syntax
    public class AllForOneStrategy : SupervisorStrategy, ISurrogated, IEquatable<AllForOneStrategy>

    Constructors

    | Edit this page View Source

    AllForOneStrategy()

    Initializes a new instance of the AllForOneStrategy class.

    Declaration
    protected AllForOneStrategy()
    | Edit this page View Source

    AllForOneStrategy(IDecider)

    Initializes a new instance of the AllForOneStrategy class.

    Declaration
    public AllForOneStrategy(IDecider decider)
    Parameters
    Type Name Description
    IDecider decider

    The mapping used to translate an Exception to a Directive.

    | Edit this page View Source

    AllForOneStrategy(Func<Exception, Directive>)

    Initializes a new instance of the AllForOneStrategy class.

    Declaration
    public AllForOneStrategy(Func<Exception, Directive> localOnlyDecider)
    Parameters
    Type Name Description
    Func<Exception, Directive> localOnlyDecider

    The mapping used to translate an Exception to a Directive.

    | Edit this page View Source

    AllForOneStrategy(int, int, IDecider, bool)

    Initializes a new instance of the AllForOneStrategy class.

    Declaration
    public AllForOneStrategy(int maxNrOfRetries, int withinTimeMilliseconds, IDecider decider, bool loggingEnabled = true)
    Parameters
    Type Name Description
    int maxNrOfRetries

    The number of times a child actor is allowed to be restarted, negative value means no limit, if the limit is exceeded the child actor is stopped.

    int withinTimeMilliseconds

    duration in milliseconds of the time window for maxNrOfRetries, negative values means no window.

    IDecider decider

    The mapping used to translate an Exception to a Directive.

    bool loggingEnabled

    If true failures will be logged

    | Edit this page View Source

    AllForOneStrategy(int, int, Func<Exception, Directive>, bool)

    Initializes a new instance of the AllForOneStrategy class.

    Declaration
    public AllForOneStrategy(int maxNrOfRetries, int withinTimeMilliseconds, Func<Exception, Directive> localOnlyDecider, bool loggingEnabled = true)
    Parameters
    Type Name Description
    int maxNrOfRetries

    The number of times a child actor is allowed to be restarted, negative value means no limit, if the limit is exceeded the child actor is stopped.

    int withinTimeMilliseconds

    duration in milliseconds of the time window for maxNrOfRetries, negative values means no window.

    Func<Exception, Directive> localOnlyDecider

    The mapping used to translate an Exception to a Directive.

    bool loggingEnabled

    If true failures will be logged

    | Edit this page View Source

    AllForOneStrategy(int?, TimeSpan?, IDecider)

    Initializes a new instance of the AllForOneStrategy class.

    Declaration
    public AllForOneStrategy(int? maxNrOfRetries, TimeSpan? withinTimeRange, IDecider decider)
    Parameters
    Type Name Description
    int? maxNrOfRetries

    The number of times a child actor is allowed to be restarted, negative value and null means no limit, if the limit is exceeded the child actor is stopped.

    TimeSpan? withinTimeRange

    duration of the time window for maxNrOfRetries, InfiniteTimeSpan means no window.

    IDecider decider

    The mapping used to translate an Exception to a Directive.

    | Edit this page View Source

    AllForOneStrategy(int?, TimeSpan?, Func<Exception, Directive>)

    Initializes a new instance of the AllForOneStrategy class.

    Declaration
    public AllForOneStrategy(int? maxNrOfRetries, TimeSpan? withinTimeRange, Func<Exception, Directive> localOnlyDecider)
    Parameters
    Type Name Description
    int? maxNrOfRetries

    The number of times a child actor is allowed to be restarted, negative value and null means no limit, if the limit is exceeded the child actor is stopped.

    TimeSpan? withinTimeRange

    duration of the time window for maxNrOfRetries, InfiniteTimeSpan means no window.

    Func<Exception, Directive> localOnlyDecider

    The mapping used to translate an Exception to a Directive.

    Properties

    | Edit this page View Source

    Decider

    The mapping from an Exception to Directive

    Declaration
    public override IDecider Decider { get; }
    Property Value
    Type Description
    IDecider
    Overrides
    SupervisorStrategy.Decider
    | Edit this page View Source

    MaxNumberOfRetries

    The number of times a child actor is allowed to be restarted, negative value means no limit, if the limit is exceeded the child actor is stopped.

    Declaration
    public int MaxNumberOfRetries { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    WithinTimeRangeMilliseconds

    The duration in milliseconds of the time window for MaxNumberOfRetries, negative values means no window.

    Declaration
    public int WithinTimeRangeMilliseconds { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Equals(AllForOneStrategy)

    Declaration
    public bool Equals(AllForOneStrategy other)
    Parameters
    Type Name Description
    AllForOneStrategy other
    Returns
    Type Description
    bool
    | Edit this page View Source

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)
    | Edit this page View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()
    | Edit this page View Source

    Handle(IActorRef, Exception)

    Determines which Directive this strategy uses to handle exception that occur in the child actor.

    Declaration
    protected override Directive Handle(IActorRef child, Exception exception)
    Parameters
    Type Name Description
    IActorRef child

    The child actor where the exception occurred.

    Exception exception

    The exception that was thrown.

    Returns
    Type Description
    Directive

    The directive used to handle the exception.

    Overrides
    SupervisorStrategy.Handle(IActorRef, Exception)
    | Edit this page View Source

    HandleChildTerminated(IActorContext, IActorRef, IEnumerable<IInternalActorRef>)

    This method is called after the child has been removed from the set of children. It does not need to do anything special. Exceptions thrown from this method do NOT make the actor fail if this happens during termination.

    Declaration
    public override void HandleChildTerminated(IActorContext actorContext, IActorRef child, IEnumerable<IInternalActorRef> children)
    Parameters
    Type Name Description
    IActorContext actorContext

    TBD

    IActorRef child

    TBD

    IEnumerable<IInternalActorRef> children

    TBD

    Overrides
    SupervisorStrategy.HandleChildTerminated(IActorContext, IActorRef, IEnumerable<IInternalActorRef>)
    | Edit this page View Source

    ProcessFailure(IActorContext, bool, IActorRef, Exception, ChildRestartStats, IReadOnlyCollection<ChildRestartStats>)

    This method is called to act on the failure of a child: restart if the flag is true, stop otherwise.

    Declaration
    public override void ProcessFailure(IActorContext context, bool restart, IActorRef child, Exception cause, ChildRestartStats stats, IReadOnlyCollection<ChildRestartStats> children)
    Parameters
    Type Name Description
    IActorContext context

    The actor context.

    bool restart

    if set to true restart, stop otherwise.

    IActorRef child

    The child actor

    Exception cause

    The exception that caused the child to fail.

    ChildRestartStats stats

    The stats for the child that failed. The ActorRef to the child can be obtained via the Child property

    IReadOnlyCollection<ChildRestartStats> children

    The stats for all children

    Overrides
    SupervisorStrategy.ProcessFailure(IActorContext, bool, IActorRef, Exception, ChildRestartStats, IReadOnlyCollection<ChildRestartStats>)
    | Edit this page View Source

    ToSurrogate(ActorSystem)

    Creates a surrogate representation of the current AllForOneStrategy.

    Declaration
    public override ISurrogate ToSurrogate(ActorSystem system)
    Parameters
    Type Name Description
    ActorSystem system

    The actor system that owns this router.

    Returns
    Type Description
    ISurrogate

    The surrogate representation of the current AllForOneStrategy.

    Overrides
    SupervisorStrategy.ToSurrogate(ActorSystem)

    Implements

    ISurrogated
    IEquatable<T>

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET