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
| Improve this Doc View SourceBackoffSupervisor(Props, String, TimeSpan, TimeSpan, IBackoffReset, Double, SupervisorStrategy, Object, Func<Object, Boolean>)
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, Boolean> | 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
| Improve this Doc 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, Int32)
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. |
Int32 | 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)
Declaration
protected override bool Receive(object message)
Parameters
Type | Name | Description |
---|---|---|
Object | message |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceSupervisorStrategy()
Declaration
protected override SupervisorStrategy SupervisorStrategy()
Returns
Type | Description |
---|---|
SupervisorStrategy |