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 |
---|---|---|
Func<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 |
Action | shutdownAction | Action that is called as the policy shuts down - if null no shutdown action is called |
Action<System.String> | logAction | Action that is called to log diagnostics - if null no logging occurs |
IEnumerable<TimeSpan> | backoffTimings | Optional set of back off timings. If null defaults to 100, 250, 500, 1000, 5000ms. |
CancellationToken | cancellationToken | A cancellation token |
Returns
Type | Description |
---|---|
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 |
---|---|---|
Func<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 |
CancellationToken | token | A cancellation token |
Returns
Type | Description |
---|---|
Task | An awaitable task |