C# Class Polly.Policy

Mostra file Open project: App-vNext/Polly Class Usage Examples

Public Methods

Method Description
Bulkhead ( int maxParallelization ) : BulkheadPolicy

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

Bulkhead ( int maxParallelization, Action onBulkheadRejected ) : BulkheadPolicy

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

Bulkhead ( int maxParallelization, int maxQueuingActions ) : BulkheadPolicy

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

Bulkhead ( int maxParallelization, int maxQueuingActions, Action onBulkheadRejected ) : BulkheadPolicy

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

BulkheadAsync ( int maxParallelization ) : BulkheadPolicy

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

BulkheadAsync ( int maxParallelization, Task>.Func onBulkheadRejectedAsync ) : BulkheadPolicy

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

BulkheadAsync ( int maxParallelization, int maxQueuingActions ) : BulkheadPolicy

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

BulkheadAsync ( int maxParallelization, int maxQueuingActions, Task>.Func onBulkheadRejectedAsync ) : BulkheadPolicy

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

Timeout ( Func timeoutProvider ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( Func timeoutProvider, Action onTimeout ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( Func timeoutProvider, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( Func timeoutProvider, TimeoutStrategy timeoutStrategy, Action onTimeout ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( System.TimeSpan timeout ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( System.TimeSpan timeout, Action onTimeout ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( System.TimeSpan timeout, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( System.TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action onTimeout ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( int seconds ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( int seconds, Action onTimeout ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( int seconds, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

Timeout ( int seconds, TimeoutStrategy timeoutStrategy, Action onTimeout ) : TimeoutPolicy

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( Func timeoutProvider ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( Func timeoutProvider, Func onTimeoutAsync ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( Func timeoutProvider, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( Func timeoutProvider, TimeoutStrategy timeoutStrategy, Func onTimeoutAsync ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( System.TimeSpan timeout ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( System.TimeSpan timeout, Func onTimeoutAsync ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( System.TimeSpan timeout, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( System.TimeSpan timeout, TimeoutStrategy timeoutStrategy, Func onTimeoutAsync ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( int seconds ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( int seconds, Func onTimeoutAsync ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( int seconds, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

TimeoutAsync ( int seconds, TimeoutStrategy timeoutStrategy, Func onTimeoutAsync ) : TimeoutPolicy

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.

WithPolicyKey ( String policyKey ) : Policy

Sets the PolicyKey for this Policy instance. Must be called before the policy is first used. Can only be set once.

Private Methods

Method Description
SetPolicyContext ( Context executionContext ) : void

Updates the execution Context with context from the executing Policy.

Method Details

Bulkhead() public static method

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

maxParallelization;Value must be greater than zero.
public static Bulkhead ( int maxParallelization ) : BulkheadPolicy
maxParallelization int The maximum number of concurrent actions that may be executing through the policy.
return BulkheadPolicy

Bulkhead() public static method

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

maxParallelization;Value must be greater than zero. onBulkheadRejected
public static Bulkhead ( int maxParallelization, Action onBulkheadRejected ) : BulkheadPolicy
maxParallelization int The maximum number of concurrent actions that may be executing through the policy.
onBulkheadRejected Action An action to call, if the bulkhead rejects execution due to oversubscription.
return BulkheadPolicy

Bulkhead() public static method

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

maxParallelization;Value must be greater than zero. maxQueuingActions;Value must be greater than or equal to zero.
public static Bulkhead ( int maxParallelization, int maxQueuingActions ) : BulkheadPolicy
maxParallelization int The maximum number of concurrent actions that may be executing through the policy.
maxQueuingActions int The maxmimum number of actions that may be queuing, waiting for an execution slot.
return BulkheadPolicy

Bulkhead() public static method

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

maxParallelization;Value must be greater than zero. maxParallelization;Value must be greater than zero. onBulkheadRejected
public static Bulkhead ( int maxParallelization, int maxQueuingActions, Action onBulkheadRejected ) : BulkheadPolicy
maxParallelization int The maximum number of concurrent actions that may be executing through the policy.
maxQueuingActions int The maxmimum number of actions that may be queuing, waiting for an execution slot.
onBulkheadRejected Action An action to call, if the bulkhead rejects execution due to oversubscription.
return BulkheadPolicy

BulkheadAsync() public static method

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

public static BulkheadAsync ( int maxParallelization ) : BulkheadPolicy
maxParallelization int The maximum number of concurrent actions that may be executing through the policy.
return BulkheadPolicy

BulkheadAsync() public static method

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the action is not executed and a BulkheadRejectedException is thrown.

maxParallelization;Value must be greater than zero. onBulkheadRejectedAsync
public static BulkheadAsync ( int maxParallelization, Task>.Func onBulkheadRejectedAsync ) : BulkheadPolicy
maxParallelization int The maximum number of concurrent actions that may be executing through the policy.
onBulkheadRejectedAsync Task>.Func An action to call asynchronously, if the bulkhead rejects execution due to oversubscription.
return BulkheadPolicy

BulkheadAsync() public static method

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

maxParallelization;Value must be greater than zero. maxQueuingActions;Value must be greater than or equal to zero.
public static BulkheadAsync ( int maxParallelization, int maxQueuingActions ) : BulkheadPolicy
maxParallelization int The maximum number of concurrent actions that may be executing through the policy.
maxQueuingActions int The maxmimum number of actions that may be queuing, waiting for an execution slot.
return BulkheadPolicy

BulkheadAsync() public static method

Builds a bulkhead isolation Policy, which limits the maximum concurrency of actions executed through the policy. Imposing a maximum concurrency limits the potential of governed actions, when faulting, to bring down the system.

When an execution would cause the number of actions executing concurrently through the policy to exceed maxParallelization, the policy allows a further maxQueuingActions executions to queue, waiting for a concurrent execution slot. When an execution would cause the number of queuing actions to exceed maxQueuingActions, a BulkheadRejectedException is thrown.

maxParallelization;Value must be greater than zero. maxQueuingActions;Value must be greater than or equal to zero. onBulkheadRejectedAsync
public static BulkheadAsync ( int maxParallelization, int maxQueuingActions, Task>.Func onBulkheadRejectedAsync ) : BulkheadPolicy
maxParallelization int The maximum number of concurrent actions that may be executing through the policy.
maxQueuingActions int The maxmimum number of actions that may be queuing, waiting for an execution slot.
onBulkheadRejectedAsync Task>.Func An action to call asynchronously, if the bulkhead rejects execution due to oversubscription.
return BulkheadPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeoutProvider
public static Timeout ( Func timeoutProvider ) : TimeoutPolicy
timeoutProvider Func A function to provide the timeout for this execution.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeoutProvider onTimeout
public static Timeout ( Func timeoutProvider, Action onTimeout ) : TimeoutPolicy
timeoutProvider Func A function to provide the timeout for this execution.
onTimeout Action An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeoutProvider
public static Timeout ( Func timeoutProvider, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy
timeoutProvider Func A function to provide the timeout for this execution.
timeoutStrategy TimeoutStrategy The timeout strategy.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeoutProvider onTimeout
public static Timeout ( Func timeoutProvider, TimeoutStrategy timeoutStrategy, Action onTimeout ) : TimeoutPolicy
timeoutProvider Func A function to provide the timeout for this execution.
timeoutStrategy TimeoutStrategy The timeout strategy.
onTimeout Action An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
public static Timeout ( System.TimeSpan timeout ) : TimeoutPolicy
timeout System.TimeSpan The timeout.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeout;Value must be greater than zero. onTimeout
public static Timeout ( System.TimeSpan timeout, Action onTimeout ) : TimeoutPolicy
timeout System.TimeSpan The timeout.
onTimeout Action An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
public static Timeout ( System.TimeSpan timeout, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy
timeout System.TimeSpan The timeout.
timeoutStrategy TimeoutStrategy The timeout strategy.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeout;Value must be greater than zero. onTimeout
public static Timeout ( System.TimeSpan timeout, TimeoutStrategy timeoutStrategy, Action onTimeout ) : TimeoutPolicy
timeout System.TimeSpan The timeout.
timeoutStrategy TimeoutStrategy The timeout strategy.
onTimeout Action An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
seconds;Value must be greater than zero.
public static Timeout ( int seconds ) : TimeoutPolicy
seconds int The number of seconds after which to timeout.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
seconds;Value must be greater than zero. onTimeout
public static Timeout ( int seconds, Action onTimeout ) : TimeoutPolicy
seconds int The number of seconds after which to timeout.
onTimeout Action An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
seconds;Value must be greater than zero.
public static Timeout ( int seconds, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy
seconds int The number of seconds after which to timeout.
timeoutStrategy TimeoutStrategy The timeout strategy.
return Polly.Timeout.TimeoutPolicy

Timeout() public static method

Builds a Policy that will wait for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
seconds;Value must be greater than zero. onTimeout
public static Timeout ( int seconds, TimeoutStrategy timeoutStrategy, Action onTimeout ) : TimeoutPolicy
seconds int The number of seconds after which to timeout.
timeoutStrategy TimeoutStrategy The timeout strategy.
onTimeout Action An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeoutProvider
public static TimeoutAsync ( Func timeoutProvider ) : TimeoutPolicy
timeoutProvider Func A function to provide the timeout for this execution.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeoutProvider onTimeoutAsync
public static TimeoutAsync ( Func timeoutProvider, Func onTimeoutAsync ) : TimeoutPolicy
timeoutProvider Func A function to provide the timeout for this execution.
onTimeoutAsync Func An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeoutProvider
public static TimeoutAsync ( Func timeoutProvider, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy
timeoutProvider Func A function to provide the timeout for this execution.
timeoutStrategy TimeoutStrategy The timeout strategy.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeoutProvider onTimeoutAsync
public static TimeoutAsync ( Func timeoutProvider, TimeoutStrategy timeoutStrategy, Func onTimeoutAsync ) : TimeoutPolicy
timeoutProvider Func A function to provide the timeout for this execution.
timeoutStrategy TimeoutStrategy The timeout strategy.
onTimeoutAsync Func An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
public static TimeoutAsync ( System.TimeSpan timeout ) : TimeoutPolicy
timeout System.TimeSpan The timeout.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeout;Value must be greater than zero. onTimeoutAsync
public static TimeoutAsync ( System.TimeSpan timeout, Func onTimeoutAsync ) : TimeoutPolicy
timeout System.TimeSpan The timeout.
onTimeoutAsync Func An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
public static TimeoutAsync ( System.TimeSpan timeout, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy
timeout System.TimeSpan The timeout.
timeoutStrategy TimeoutStrategy The timeout strategy.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
timeout;Value must be greater than zero. onTimeoutAsync
public static TimeoutAsync ( System.TimeSpan timeout, TimeoutStrategy timeoutStrategy, Func onTimeoutAsync ) : TimeoutPolicy
timeout System.TimeSpan The timeout.
timeoutStrategy TimeoutStrategy The timeout strategy.
onTimeoutAsync Func An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
seconds;Value must be greater than zero.
public static TimeoutAsync ( int seconds ) : TimeoutPolicy
seconds int The number of seconds after which to timeout.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
seconds;Value must be greater than zero. onTimeoutAsync
public static TimeoutAsync ( int seconds, Func onTimeoutAsync ) : TimeoutPolicy
seconds int The number of seconds after which to timeout.
onTimeoutAsync Func An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
seconds;Value must be greater than zero.
public static TimeoutAsync ( int seconds, TimeoutStrategy timeoutStrategy ) : TimeoutPolicy
seconds int The number of seconds after which to timeout.
timeoutStrategy TimeoutStrategy The timeout strategy.
return Polly.Timeout.TimeoutPolicy

TimeoutAsync() public static method

Builds a Policy that will wait asynchronously for a delegate to complete for a specified period of time. A TimeoutRejectedException will be thrown if the delegate does not complete within the configured timeout.
seconds;Value must be greater than zero. seconds;Value must be greater than zero.
public static TimeoutAsync ( int seconds, TimeoutStrategy timeoutStrategy, Func onTimeoutAsync ) : TimeoutPolicy
seconds int The number of seconds after which to timeout.
timeoutStrategy TimeoutStrategy The timeout strategy.
onTimeoutAsync Func An action to call on timeout, passing the execution context, the timeout applied, and a capturing the abandoned, timed-out action. /// The Task parameter will be null if the executed action responded co-operatively to cancellation before the policy timed it out.
return TimeoutPolicy

WithPolicyKey() public method

Sets the PolicyKey for this Policy instance. Must be called before the policy is first used. Can only be set once.
public WithPolicyKey ( String policyKey ) : Policy
policyKey String The unique, used-definable key to assign to this instance.
return Policy