Interface IAsynchronousBackoffPolicy
Asynchronous backoff policy that is used by deferred command processors
Namespace: AzureFromTheTrenches.Commanding.Queue
Assembly: AzureFromTheTrenches.Commanding.Queue.dll
Syntax
public interface IAsynchronousBackoffPolicy
Methods
| Improve this Doc View SourceExecuteAsync(Func<Task<Boolean>>, Action, Action<String>, IEnumerable<TimeSpan>, CancellationToken)
Execute an action inside the backoff policy
Declaration
Task ExecuteAsync(Func<Task<bool>> function, Action shutdownAction, Action<string> logAction, IEnumerable<TimeSpan> backoffTimings, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<System.Threading.Tasks.Task<System.Boolean>> | function | Function to execute - should return true if it the function had work to perform, false if it did not and the back off policy needs to begin |
| System.Action | shutdownAction | Action that is called as the policy shuts down - if null no shutdown action is called |
| System.Action<System.String> | logAction | Action that is called to log diagnostics - if null no logging occurs |
| System.Collections.Generic.IEnumerable<System.TimeSpan> | backoffTimings | Optional set of back off timings. If null defaults to 100, 250, 500, 1000, 5000ms. |
| System.Threading.CancellationToken | cancellationToken | A cancellation token |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | An awaitable task |
ExecuteAsync(Func<Task<Boolean>>, CancellationToken)
Execute an action inside the backoff policy
Declaration
Task ExecuteAsync(Func<Task<bool>> function, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<System.Threading.Tasks.Task<System.Boolean>> | function | Function to execute - should return true if it the function had work to perform, false if it did not and the back off policy needs to begin |
| System.Threading.CancellationToken | token | A cancellation token |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | An awaitable task |