Search Results for

    Show / Hide Table of Contents

    Class AbstractStash

    INTERNAL API

    Support class for implementing a stash for an actor instance. A default stash per actor (= user stash) is maintained by this class. Actors that explicitly need other stashes (optionally in addition to and isolated from the user stash) can create new stashes via StashFactory.

    Inheritance
    object
    AbstractStash
    BoundedStashImpl
    UnboundedStashImpl
    Implements
    IStash
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Actor.Internal
    Assembly: Akka.dll
    Syntax
    public abstract class AbstractStash : IStash

    Constructors

    | Edit this page View Source

    AbstractStash(IActorContext)

    Declaration
    protected AbstractStash(IActorContext context)
    Parameters
    Type Name Description
    IActorContext context

    Properties

    | Edit this page View Source

    Capacity

    The capacity of the stash. Configured in the actor's mailbox or dispatcher config.

    Declaration
    public virtual int Capacity { get; }
    Property Value
    Type Description
    int
    Remarks

    If capacity is negative, then we're using an Unbounded stash.

    | Edit this page View Source

    Count

    The number of messages currently inside the stash.

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

    IsEmpty

    Returns true when Count is zero.

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

    IsFull

    When using a bounded stash, this returns true when the stash is full.

    Declaration
    public bool IsFull { get; }
    Property Value
    Type Description
    bool
    Remarks

    Always returns false when using an unbounded stash.

    | Edit this page View Source

    NonEmpty

    Returns true when Count is greater than zero.

    Declaration
    public bool NonEmpty { get; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    ClearStash()

    INTERNAL API.

    Clears the stash and and returns all envelopes that have not been unstashed.

    Declaration
    public IEnumerable<Envelope> ClearStash()
    Returns
    Type Description
    IEnumerable<Envelope>

    Previously stashed messages.

    | Edit this page View Source

    Prepend(IEnumerable<Envelope>)

    Prepends others to this stash. This method is optimized for a large stash and small others.

    Declaration
    public void Prepend(IEnumerable<Envelope> envelopes)
    Parameters
    Type Name Description
    IEnumerable<Envelope> envelopes

    TBD

    | Edit this page View Source

    Stash()

    Adds the current message (the message that the actor received last) to the actor's stash.

    Declaration
    public void Stash()
    Exceptions
    Type Condition
    IllegalActorStateException

    This exception is thrown if we attempt to stash the same message more than once.

    StashOverflowException

    This exception is thrown in the event that we're using a BoundedMessageQueue for the IStash and we've exceeded capacity.

    | Edit this page View Source

    Unstash()

    Prepends the oldest message in the stash to the mailbox, and then removes that message from the stash.

    Messages from the stash are enqueued to the mailbox until the capacity of the mailbox (if any) has been reached. In case a bounded mailbox overflows, a `MessageQueueAppendFailedException` is thrown.

    The unstashed message is guaranteed to be removed from the stash regardless if the Unstash() call successfully returns or throws an exception.
    Declaration
    public void Unstash()
    | Edit this page View Source

    UnstashAll()

    Prepends all messages in the stash to the mailbox, and then clears the stash.

    Messages from the stash are enqueued to the mailbox until the capacity of the mailbox(if any) has been reached. In case a bounded mailbox overflows, a `MessageQueueAppendFailedException` is thrown.

    The stash is guaranteed to be empty after calling UnstashAll().
    Declaration
    public void UnstashAll()
    | Edit this page View Source

    UnstashAll(Func<Envelope, bool>)

    INTERNA API

    Prepends selected messages in the stash, applying `filterPredicate`, to the mailbox, and then clears the stash.

    Messages from the stash are enqueued to the mailbox until the capacity of the mailbox(if any) has been reached. In case a bounded mailbox overflows, a `MessageQueueAppendFailedException` is thrown.

    The stash is guaranteed to be empty after calling UnstashAll(Func<Envelope, bool>).
    Declaration
    public void UnstashAll(Func<Envelope, bool> filterPredicate)
    Parameters
    Type Name Description
    Func<Envelope, bool> filterPredicate

    Only stashed messages selected by this predicate are prepended to the mailbox.

    Implements

    IStash

    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