public static class PollingHelper methods for polling scenarios.
Namespace
Google.Api.GaxAssembly
Google.Api.Gax.dll
Methods
PollRepeatedlyAsync<TResponse>(Func<DateTime?, Task<TResponse>>, Predicate<TResponse>, IClock, IScheduler, PollSettings, CancellationToken)
public static Task<TResponse> PollRepeatedlyAsync<TResponse>(Func<DateTime?, Task<TResponse>> pollAction, Predicate<TResponse> completionPredicate, IClock clock, IScheduler scheduler, PollSettings pollSettings, CancellationToken cancellationToken)Asynchronously repeatedly calls the specified polling action, delaying between calls, until a given condition is met in the response.
| Parameters | |
|---|---|
| Name | Description | 
pollAction | 
        FuncDateTimeTaskThe poll action, typically performing an RPC. The value passed to the action is the overall deadline, so that the RPC settings can be adjusted accordingly. A null value indicates no deadline.  | 
      
completionPredicate | 
        PredicateThe test for whether to return the response (  | 
      
clock | 
        IClockThe clock to use for determining deadlines. Must not be null.  | 
      
scheduler | 
        ISchedulerThe scheduler to use for delaying between calls. Must not be null.  | 
      
pollSettings | 
        PollSettingsThe poll settings, controlling timeouts, call settings and delays.  | 
      
cancellationToken | 
        CancellationTokenThe cancellation token used to cancel delays, if any.  | 
      
| Returns | |
|---|---|
| Type | Description | 
Task | 
        A task representing the asynchronous operation. The result of the task will be the completed response.  | 
      
| Type Parameter | |
|---|---|
| Name | Description | 
TResponse | 
        The response type.  | 
      
PollRepeatedly<TResponse>(Func<DateTime?, TResponse>, Predicate<TResponse>, IClock, IScheduler, PollSettings, CancellationToken)
public static TResponse PollRepeatedly<TResponse>(Func<DateTime?, TResponse> pollAction, Predicate<TResponse> completionPredicate, IClock clock, IScheduler scheduler, PollSettings pollSettings, CancellationToken cancellationToken)Repeatedly calls the specified polling action, delaying between calls, until a given condition is met in the response.
| Parameters | |
|---|---|
| Name | Description | 
pollAction | 
        FuncDateTimeThe poll action, typically performing an RPC. The value passed to the action is the overall deadline, so that the RPC settings can be adjusted accordingly. A null value indicates no deadline.  | 
      
completionPredicate | 
        PredicateThe test for whether to return the response (  | 
      
clock | 
        IClockThe clock to use for determining deadlines. Must not be null.  | 
      
scheduler | 
        ISchedulerThe scheduler to use for delaying between calls. Must not be null.  | 
      
pollSettings | 
        PollSettingsThe poll settings, controlling timeouts, call settings and delays.  | 
      
cancellationToken | 
        CancellationTokenThe cancellation token used to cancel delays, if any.  | 
      
| Returns | |
|---|---|
| Type | Description | 
TResponse | 
        The completed response.  | 
      
| Type Parameter | |
|---|---|
| Name | Description | 
TResponse | 
        The response type.  | 
      
| Exceptions | |
|---|---|
| Type | Description | 
TimeoutException | 
        The timeout specified in the poll settings expired.  |