Condividi tramite


ServicePartitionClient<TCommunicationClient>.InvokeWithRetryAsync Method

Definition

Overloads

InvokeWithRetryAsync(Func<TCommunicationClient,Task>, Type[])

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not. If you are invoking this method in Asp.Net / UI thread, these are recommendations to avoid deadlock: 1 if your calling Api is Async , use ConfigureAwait(Boolean) to not to resume in orignal context by setting it to false. 2 Or To invoke this Api in a threadpool thread using Task.Run.

InvokeWithRetryAsync(Func<TCommunicationClient,Task>, CancellationToken, Type[])

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not. If you are invoking this method in Asp.Net / UI thread, these are recommendations to avoid deadlock: 1 if your calling Api is Async , use ConfigureAwait(Boolean) to not to resume in orignal context by setting it to false. 2 Or To invoke this Api in a threadpool thread using Task.Run.

InvokeWithRetryAsync<TResult>(Func<TCommunicationClient,Task<TResult>>, Type[])

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not. If you are invoking this method in Asp.Net / UI thread, these are recommendations to avoid deadlock: 1 if your calling Api is Async , use ConfigureAwait(Boolean) to not to resume in orignal context by setting it to false. 2 Or To invoke this Api in a threadpool thread using Task.Run.

InvokeWithRetryAsync<TResult>(Func<TCommunicationClient,Task<TResult>>, CancellationToken, Type[])

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not. If you are invoking this method in Asp.Net / UI thread, these are recommendations to avoid deadlock: 1 if your calling Api is Async , use ConfigureAwait(Boolean) to not to resume in orignal context by setting it to false. 2 Or To invoke this Api in a threadpool thread using Task.Run.

InvokeWithRetryAsync(Func<TCommunicationClient,Task>, Type[])

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not. If you are invoking this method in Asp.Net / UI thread, these are recommendations to avoid deadlock: 1 if your calling Api is Async , use ConfigureAwait(Boolean) to not to resume in orignal context by setting it to false. 2 Or To invoke this Api in a threadpool thread using Task.Run.

public System.Threading.Tasks.Task InvokeWithRetryAsync (Func<TCommunicationClient,System.Threading.Tasks.Task> func, params Type[] doNotRetryExceptionTypes);
member this.InvokeWithRetryAsync : Func<'CommunicationClient, System.Threading.Tasks.Task (requires 'CommunicationClient :> Microsoft.ServiceFabric.Services.Communication.Client.ICommunicationClient)> * Type[] -> System.Threading.Tasks.Task
Public Function InvokeWithRetryAsync (func As Func(Of TCommunicationClient, Task), ParamArray doNotRetryExceptionTypes As Type()) As Task

Parameters

func
Func<TCommunicationClient,Task>

Function being invoked

doNotRetryExceptionTypes
Type[]

Exceptions for which the service partition client should not retry

Returns

A Task that represents outstanding operation.

Applies to

InvokeWithRetryAsync(Func<TCommunicationClient,Task>, CancellationToken, Type[])

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not. If you are invoking this method in Asp.Net / UI thread, these are recommendations to avoid deadlock: 1 if your calling Api is Async , use ConfigureAwait(Boolean) to not to resume in orignal context by setting it to false. 2 Or To invoke this Api in a threadpool thread using Task.Run.

public System.Threading.Tasks.Task InvokeWithRetryAsync (Func<TCommunicationClient,System.Threading.Tasks.Task> func, System.Threading.CancellationToken cancellationToken, params Type[] doNotRetryExceptionTypes);
member this.InvokeWithRetryAsync : Func<'CommunicationClient, System.Threading.Tasks.Task (requires 'CommunicationClient :> Microsoft.ServiceFabric.Services.Communication.Client.ICommunicationClient)> * System.Threading.CancellationToken * Type[] -> System.Threading.Tasks.Task
Public Function InvokeWithRetryAsync (func As Func(Of TCommunicationClient, Task), cancellationToken As CancellationToken, ParamArray doNotRetryExceptionTypes As Type()) As Task

Parameters

func
Func<TCommunicationClient,Task>

Function being invoked

cancellationToken
CancellationToken

Cancellation token

doNotRetryExceptionTypes
Type[]

Exceptions for which the service partition client should not retry

Returns

A Task that represents outstanding operation.

Applies to

InvokeWithRetryAsync<TResult>(Func<TCommunicationClient,Task<TResult>>, Type[])

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not. If you are invoking this method in Asp.Net / UI thread, these are recommendations to avoid deadlock: 1 if your calling Api is Async , use ConfigureAwait(Boolean) to not to resume in orignal context by setting it to false. 2 Or To invoke this Api in a threadpool thread using Task.Run.

public System.Threading.Tasks.Task<TResult> InvokeWithRetryAsync<TResult> (Func<TCommunicationClient,System.Threading.Tasks.Task<TResult>> func, params Type[] doNotRetryExceptionTypes);
member this.InvokeWithRetryAsync : Func<'CommunicationClient, System.Threading.Tasks.Task<'Result> (requires 'CommunicationClient :> Microsoft.ServiceFabric.Services.Communication.Client.ICommunicationClient)> * Type[] -> System.Threading.Tasks.Task<'Result>
Public Function InvokeWithRetryAsync(Of TResult) (func As Func(Of TCommunicationClient, Task(Of TResult)), ParamArray doNotRetryExceptionTypes As Type()) As Task(Of TResult)

Type Parameters

TResult

Result from the function being invoked

Parameters

func
Func<TCommunicationClient,Task<TResult>>

Function being invoked

doNotRetryExceptionTypes
Type[]

Exceptions for which the service partition client should not retry

Returns

Task<TResult>

A Task that represents outstanding operation. The result of the Task is the result from the function given in the argument.

Applies to

InvokeWithRetryAsync<TResult>(Func<TCommunicationClient,Task<TResult>>, CancellationToken, Type[])

Invokes the given Function, retrying for exceptions thrown other than the exceptions in the doNotRetryExceptionTypes. For exceptions that are not in doNotRetryExceptionTypes, CommunicationClientFactory's ReportOperationExceptionAsync() method controls if the exception should be retried or not. If you are invoking this method in Asp.Net / UI thread, these are recommendations to avoid deadlock: 1 if your calling Api is Async , use ConfigureAwait(Boolean) to not to resume in orignal context by setting it to false. 2 Or To invoke this Api in a threadpool thread using Task.Run.

public System.Threading.Tasks.Task<TResult> InvokeWithRetryAsync<TResult> (Func<TCommunicationClient,System.Threading.Tasks.Task<TResult>> func, System.Threading.CancellationToken cancellationToken, params Type[] doNotRetryExceptionTypes);
member this.InvokeWithRetryAsync : Func<'CommunicationClient, System.Threading.Tasks.Task<'Result> (requires 'CommunicationClient :> Microsoft.ServiceFabric.Services.Communication.Client.ICommunicationClient)> * System.Threading.CancellationToken * Type[] -> System.Threading.Tasks.Task<'Result>
Public Function InvokeWithRetryAsync(Of TResult) (func As Func(Of TCommunicationClient, Task(Of TResult)), cancellationToken As CancellationToken, ParamArray doNotRetryExceptionTypes As Type()) As Task(Of TResult)

Type Parameters

TResult

Result from the function being invoked

Parameters

func
Func<TCommunicationClient,Task<TResult>>

Function being invoked

cancellationToken
CancellationToken

Cancellation token

doNotRetryExceptionTypes
Type[]

Exceptions for which the service partition client should not retry

Returns

Task<TResult>

A Task that represents outstanding operation. The result of the Task is the result from the function given in the argument.

Exceptions

The operation has been canceled.

Applies to