You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `IWithStash` interface enables an actor to temporarily stash away messages that can not or should not be handled using the actor's current behavior. Upon changing the actor's message handler, i.e., right before invoking `Context.Become()` or `Context.Unbecome()`, all stashed messages can be "un-stashed", thereby prepending them to the actor's mailbox. This way, the stashed messages can be processed in the same order as they have been received originally.
711
+
The `UntypedActorWithStash` class enables an actor to temporarily stash away messages that can not or should not be handled using the actor's current behavior. Upon changing the actor's message handler, i.e., right before invoking `Context.Become()` or `Context.Unbecome()`, all stashed messages can be "un-stashed", thereby prepending them to the actor's mailbox. This way, the stashed messages can be processed in the same order as they have been received originally. An actor that extends `UntypedActorWithStash` will automatically get a deque-based mailbox.
712
712
713
713
> [!NOTE]
714
-
> The interface `IWithStash` implements the marker interface `IRequiresMessageQueue<DequeBasedMessageQueueSemantics>` which requests the system to automatically choose a deque-based mailbox implementation for the actor (defaults to an unbounded deque mailbox). If you want more control over the mailbox, see the documentation on mailboxes: [Mailboxes](xref:mailboxes).
714
+
> The abstract class `UntypedActorWithStash` implements the marker interface `IRequiresMessageQueue<DequeBasedMessageQueueSemantics>` which requests the system to automatically choose a deque-based mailbox implementation for the actor. If you want more control over the mailbox, see the documentation on mailboxes: [Mailboxes](xref:mailboxes).
715
715
716
-
Here is an example of the `IWithStash` interface in action:
716
+
Here is an example of the `UntypedActorWithStash` interface in action:
@@ -755,14 +753,10 @@ Invoking `Stash()` adds the current message (the message that the actor received
755
753
756
754
Invoking `UnstashAll()` enqueues messages from the stash to the actor's mailbox until the capacity of the mailbox (if any) has been reached (note that messages from the stash are prepended to the mailbox). In case a bounded mailbox overflows, a `MessageQueueAppendFailedException` is thrown. The stash is guaranteed to be empty after calling `UnstashAll()`.
757
755
758
-
Note that the stash is part of the ephemeral actor state, unlike the mailbox. Therefore, it should be managed like other parts of the actor's state which have the same property.
759
-
760
-
However, the `IWithStash` interface implementation of `PreRestart` will call `UnstashAll()`. This means that before the actor restarts, it will transfer all stashed messages back to the actor’s mailbox.
761
-
762
-
The result of this is that when an actor is restarted, any stashed messages will be delivered to the new incarnation of the actor. This is usually the desired behavior.
756
+
Note that the stash is part of the ephemeral actor state, unlike the mailbox. Therefore, it should be managed like other parts of the actor's state which have the same property. The `UntypedActorWithStash` implementation of `PreRestart` will call `UnstashAll()`, which is usually the desired behavior.
763
757
764
758
> [!NOTE]
765
-
> If you want to enforce that your actor can only work with an unbounded stash, then you should use the `IWithUnboundedStash` interface instead.
759
+
> If you want to enforce that your actor can only work with an unbounded stash, then you should use the `UntypedActorWithUnboundedStash ` class instead.
public abstract class UntypedActorWithStash : Akka.Actor.UntypedActor, Akka.Actor.IActorStash, Akka.Actor.IWithStash, Akka.Actor.IWithUnrestrictedStash, Akka.Dispatch.IRequiresMessageQueue<Akka.Dispatch.IDequeBasedMessageQueueSemantics>
1868
+
{
1869
+
protected UntypedActorWithStash() { }
1870
+
public Akka.Actor.IStash Stash { get; set; }
1871
+
}
1872
+
public abstract class UntypedActorWithUnboundedStash : Akka.Actor.UntypedActor, Akka.Actor.IActorStash, Akka.Actor.IWithUnboundedStash, Akka.Actor.IWithUnrestrictedStash, Akka.Dispatch.IRequiresMessageQueue<Akka.Dispatch.IUnboundedDequeBasedMessageQueueSemantics>
1873
+
{
1874
+
protected UntypedActorWithUnboundedStash() { }
1875
+
public Akka.Actor.IStash Stash { get; set; }
1876
+
}
1877
+
public abstract class UntypedActorWithUnrestrictedStash : Akka.Actor.UntypedActor, Akka.Actor.IActorStash, Akka.Actor.IWithUnrestrictedStash
1878
+
{
1879
+
protected UntypedActorWithUnrestrictedStash() { }
1880
+
public Akka.Actor.IStash Stash { get; set; }
1881
+
}
1867
1882
public delegate void UntypedReceive(object message);
public abstract class UntypedActorWithStash : Akka.Actor.UntypedActor, Akka.Actor.IActorStash, Akka.Actor.IWithStash, Akka.Actor.IWithUnrestrictedStash, Akka.Dispatch.IRequiresMessageQueue<Akka.Dispatch.IDequeBasedMessageQueueSemantics>
1870
+
{
1871
+
protected UntypedActorWithStash() { }
1872
+
public Akka.Actor.IStash Stash { get; set; }
1873
+
}
1874
+
public abstract class UntypedActorWithUnboundedStash : Akka.Actor.UntypedActor, Akka.Actor.IActorStash, Akka.Actor.IWithUnboundedStash, Akka.Actor.IWithUnrestrictedStash, Akka.Dispatch.IRequiresMessageQueue<Akka.Dispatch.IUnboundedDequeBasedMessageQueueSemantics>
1875
+
{
1876
+
protected UntypedActorWithUnboundedStash() { }
1877
+
public Akka.Actor.IStash Stash { get; set; }
1878
+
}
1879
+
public abstract class UntypedActorWithUnrestrictedStash : Akka.Actor.UntypedActor, Akka.Actor.IActorStash, Akka.Actor.IWithUnrestrictedStash
1880
+
{
1881
+
protected UntypedActorWithUnrestrictedStash() { }
1882
+
public Akka.Actor.IStash Stash { get; set; }
1883
+
}
1869
1884
public delegate void UntypedReceive(object message);
public abstract class UntypedActorWithStash : Akka.Actor.UntypedActor, Akka.Actor.IActorStash, Akka.Actor.IWithStash, Akka.Actor.IWithUnrestrictedStash, Akka.Dispatch.IRequiresMessageQueue<Akka.Dispatch.IDequeBasedMessageQueueSemantics>
1868
+
{
1869
+
protected UntypedActorWithStash() { }
1870
+
public Akka.Actor.IStash Stash { get; set; }
1871
+
}
1872
+
public abstract class UntypedActorWithUnboundedStash : Akka.Actor.UntypedActor, Akka.Actor.IActorStash, Akka.Actor.IWithUnboundedStash, Akka.Actor.IWithUnrestrictedStash, Akka.Dispatch.IRequiresMessageQueue<Akka.Dispatch.IUnboundedDequeBasedMessageQueueSemantics>
1873
+
{
1874
+
protected UntypedActorWithUnboundedStash() { }
1875
+
public Akka.Actor.IStash Stash { get; set; }
1876
+
}
1877
+
public abstract class UntypedActorWithUnrestrictedStash : Akka.Actor.UntypedActor, Akka.Actor.IActorStash, Akka.Actor.IWithUnrestrictedStash
1878
+
{
1879
+
protected UntypedActorWithUnrestrictedStash() { }
1880
+
public Akka.Actor.IStash Stash { get; set; }
1881
+
}
1867
1882
public delegate void UntypedReceive(object message);
0 commit comments