Class BackoffSupervisor
Actor used to supervise actors with ability to restart them after back-off timeout occurred. It's designed for cases when i.e. persistent actor stops due to journal unavailability or failure. In this case it is better to wait before restart.
Implements
Inherited Members
Namespace: Akka.Pattern
Assembly: Akka.dll
Syntax
public sealed class BackoffSupervisor : BackoffSupervisorBase, IInternalActor
Constructors
| Edit this page View SourceBackoffSupervisor(Props, string, TimeSpan, TimeSpan, IBackoffReset, double, SupervisorStrategy, object, Func<object, bool>)
If the arguments here change, you -must- change the invocation in BackoffOptions accordingly! Expression based props are too slow for many scenarios, so we must drop compile time safety for that sake.
Declaration
public BackoffSupervisor(Props childProps, string childName, TimeSpan minBackoff, TimeSpan maxBackoff, IBackoffReset reset, double randomFactor, SupervisorStrategy strategy, object replyWhileStopped = null, Func<object, bool> finalStopMessage = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Props | childProps | |
| string | childName | |
| TimeSpan | minBackoff | |
| TimeSpan | maxBackoff | |
| IBackoffReset | reset | |
| double | randomFactor | |
| SupervisorStrategy | strategy | |
| object | replyWhileStopped | |
| Func<object, bool> | finalStopMessage |
BackoffSupervisor(Props, string, TimeSpan, TimeSpan, double)
Declaration
public BackoffSupervisor(Props childProps, string childName, TimeSpan minBackoff, TimeSpan maxBackoff, double randomFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| Props | childProps | |
| string | childName | |
| TimeSpan | minBackoff | |
| TimeSpan | maxBackoff | |
| double | randomFactor |
Methods
| Edit this page View SourceProps(Props, string, TimeSpan, TimeSpan, double)
Props for creating a BackoffSupervisor actor.
Declaration
public static Props Props(Props childProps, string childName, TimeSpan minBackoff, TimeSpan maxBackoff, double randomFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| Props | childProps | The Props of the child actor that will be started and supervised |
| string | childName | Name of the child actor |
| TimeSpan | minBackoff | Minimum (initial) duration until the child actor will started again, if it is terminated |
| TimeSpan | maxBackoff | The exponential back-off is capped to this duration |
| double | randomFactor | After calculation of the exponential back-off an additional random delay based on this factor is added, e.g. |
Returns
| Type | Description |
|---|---|
| Props |
Props(Props, string, TimeSpan, TimeSpan, double, int)
Props for creating a BackoffSupervisor actor.
Exceptions in the child are handled with the default supervision strategy, i.e. most exceptions will immediately restart the child. You can define another supervision strategy by using [[#propsWithSupervisorStrategy]].
Declaration
public static Props Props(Props childProps, string childName, TimeSpan minBackoff, TimeSpan maxBackoff, double randomFactor, int maxNrOfRetries)
Parameters
| Type | Name | Description |
|---|---|---|
| Props | childProps | The Props of the child actor that will be started and supervised |
| string | childName | Name of the child actor |
| TimeSpan | minBackoff | Minimum (initial) duration until the child actor will started again, if it is terminated |
| TimeSpan | maxBackoff | The exponential back-off is capped to this duration |
| double | randomFactor | After calculation of the exponential back-off an additional random delay based on this factor is added, e.g. |
| int | maxNrOfRetries | Maximum number of attempts to restart the child actor. The supervisor will terminate itself after the maxNoOfRetries is reached. In order to restart infinitely pass in |
Returns
| Type | Description |
|---|---|
| Props |
Props(BackoffOptions)
Props for creating a BackoffSupervisor actor from BackoffOptions.
Declaration
public static Props Props(BackoffOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| BackoffOptions | options | The BackoffOptions that specify how to construct a backoff-supervisor. |
Returns
| Type | Description |
|---|---|
| Props |
PropsWithSupervisorStrategy(Props, string, TimeSpan, TimeSpan, double, SupervisorStrategy)
Props for creating a BackoffSupervisor actor with a custom supervision strategy.
Declaration
public static Props PropsWithSupervisorStrategy(Props childProps, string childName, TimeSpan minBackoff, TimeSpan maxBackoff, double randomFactor, SupervisorStrategy strategy)
Parameters
| Type | Name | Description |
|---|---|---|
| Props | childProps | The Props of the child actor that will be started and supervised |
| string | childName | Name of the child actor |
| TimeSpan | minBackoff | Minimum (initial) duration until the child actor will started again, if it is terminated |
| TimeSpan | maxBackoff | The exponential back-off is capped to this duration |
| double | randomFactor | After calculation of the exponential back-off an additional random delay based on this factor is added, e.g. |
| SupervisorStrategy | strategy | The supervision strategy to use for handling exceptions in the child |
Returns
| Type | Description |
|---|---|
| Props |
Receive(object)
Processor for user defined messages.
Declaration
protected override bool Receive(object message)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message. |
Returns
| Type | Description |
|---|---|
| bool | TBD |
Overrides
| Edit this page View SourceSupervisorStrategy()
TBD
Declaration
protected override SupervisorStrategy SupervisorStrategy()
Returns
| Type | Description |
|---|---|
| SupervisorStrategy | TBD |
Edit this page