Class GracefulStopSupport
Returns a Task that will be completed with success when existing messages of the target actor have been processed and the actor has been terminated.
Useful when you need to wait for termination or compose ordered termination of several actors, which should only be done outside of the ActorSystem as blocking inside ActorBase is discouraged.
IMPORTANT:
the actor being terminated and its supervisor being informed of the availability of the deceased actor's name
are two distinct operations, which do not obey any reliable ordering.If the target actor isn't terminated within the timeout the Task is completed with failure.
If you want to invoke specialized stopping logic on your target actor instead of PoisonPill, you can pass your stop command as a parameter:
GracefulStop(someChild, timeout, MyStopGracefullyMessage).ContinueWith(r => {
// Do something after someChild starts being stopped.
});
Inherited Members
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public static class GracefulStopSupport
Methods
| Improve this Doc View SourceGracefulStop(IActorRef, TimeSpan)
TBD
Declaration
public static Task<bool> GracefulStop(this IActorRef target, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | target | TBD |
TimeSpan | timeout | TBD |
Returns
Type | Description |
---|---|
Task<Boolean> | TBD |
GracefulStop(IActorRef, TimeSpan, Object)
TBD
Declaration
public static Task<bool> GracefulStop(this IActorRef target, TimeSpan timeout, object stopMessage)
Parameters
Type | Name | Description |
---|---|---|
IActorRef | target | TBD |
TimeSpan | timeout | TBD |
Object | stopMessage | TBD |
Returns
Type | Description |
---|---|
Task<Boolean> | TBD |
Exceptions
Type | Condition |
---|---|
TaskCanceledException | This exception is thrown if the underlying task is Canceled. |