C# Класс Microsoft.AspNet.WebHooks.DataflowWebHookSender

Provides an implementation of IWebHookSender for sending HTTP requests to registered WebHook instances using a default WebHook wire format and retry mechanism.
Наследование: WebHookSender
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
DataflowWebHookSender ( ILogger logger ) : System

Initializes a new instance of the DataflowWebHookSender class with a default retry policy.

DataflowWebHookSender ( ILogger logger, IEnumerable retryDelays, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions options ) : System

Initializes a new instance of the DataflowWebHookSender class with a given collection of retryDelays and options for how to manage the queuing policy for each transmission. The transmission model is as follows: each try and subsequent retries is managed by a separate ActionBlock{T} which controls the level of concurrency used to send out WebHooks. The options parameter can be used to control all ActionBlock{T} instances by setting the maximum level of concurrency, length of queue, and more.

SendWebHookWorkItemsAsync ( IEnumerable workItems ) : System.Threading.Tasks.Task

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Releases the unmanaged resources and optionally releases the managed resources.

OnWebHookFailure ( WebHookWorkItem workItem ) : System.Threading.Tasks.Task

If delivery of a WebHook is not successful, i.e. something other than a 2xx or 410 Gone HTTP status code is received after having retried the request according to the retry-policy, then OnWebHookFailure is called enabling additional post-processing.

OnWebHookGone ( WebHookWorkItem workItem ) : System.Threading.Tasks.Task

If delivery of a WebHook results in a 410 Gone HTTP status code, then OnWebHookGone is called enabling additional post-processing.

OnWebHookRetry ( WebHookWorkItem workItem ) : System.Threading.Tasks.Task

If delivery of a WebHook is not successful, i.e. something other than a 2xx or 410 Gone HTTP status code is received and the request is to be retried, then OnWebHookRetry is called enabling additional post-processing of a retry request.

OnWebHookSuccess ( WebHookWorkItem workItem ) : System.Threading.Tasks.Task

If delivery of a WebHook is successful, i.e. a 2xx HTTP status code is received, then OnWebHookSuccess is called enabling additional post-processing.

Приватные методы

Метод Описание
DataflowWebHookSender ( ILogger logger, IEnumerable retryDelays, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions options, HttpClient httpClient ) : System

Initialize a new instance of the DataflowWebHookSender with the given retry policy, options, and httpClient. This constructor is intended for unit testing purposes.

DelayedLaunchWebHook ( WebHookWorkItem item, System.TimeSpan delay ) : System.Threading.Tasks.Task
LaunchWebHook ( WebHookWorkItem workItem ) : System.Threading.Tasks.Task

Launch a WebHook.

We don't let exceptions propagate out from this method as it is used by the launchers and if they see an exception they shut down.

Описание методов

DataflowWebHookSender() публичный Метод

Initializes a new instance of the DataflowWebHookSender class with a default retry policy.
public DataflowWebHookSender ( ILogger logger ) : System
logger ILogger The current .
Результат System

DataflowWebHookSender() публичный Метод

Initializes a new instance of the DataflowWebHookSender class with a given collection of retryDelays and options for how to manage the queuing policy for each transmission. The transmission model is as follows: each try and subsequent retries is managed by a separate ActionBlock{T} which controls the level of concurrency used to send out WebHooks. The options parameter can be used to control all ActionBlock{T} instances by setting the maximum level of concurrency, length of queue, and more.
public DataflowWebHookSender ( ILogger logger, IEnumerable retryDelays, System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions options ) : System
logger ILogger The current .
retryDelays IEnumerable A collection of instances indicating the delay between each retry. If null, /// then a default retry policy is used of one retry after one 1 minute and then again after 4 minutes. A retry is attempted if the /// delivery fails or does not result in a 2xx HTTP status code. If the status code is 410 then no retry is attempted. If the collection /// is empty then no retries are attempted.
options System.Threading.Tasks.Dataflow.ExecutionDataflowBlockOptions An used to control the instances. /// The default setting uses a maximum of 8 concurrent transmitters for each try or retry.
Результат System

Dispose() защищенный Метод

Releases the unmanaged resources and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
Результат void

OnWebHookFailure() защищенный Метод

If delivery of a WebHook is not successful, i.e. something other than a 2xx or 410 Gone HTTP status code is received after having retried the request according to the retry-policy, then OnWebHookFailure is called enabling additional post-processing.
protected OnWebHookFailure ( WebHookWorkItem workItem ) : System.Threading.Tasks.Task
workItem WebHookWorkItem The current .
Результат System.Threading.Tasks.Task

OnWebHookGone() защищенный Метод

If delivery of a WebHook results in a 410 Gone HTTP status code, then OnWebHookGone is called enabling additional post-processing.
protected OnWebHookGone ( WebHookWorkItem workItem ) : System.Threading.Tasks.Task
workItem WebHookWorkItem The current .
Результат System.Threading.Tasks.Task

OnWebHookRetry() защищенный Метод

If delivery of a WebHook is not successful, i.e. something other than a 2xx or 410 Gone HTTP status code is received and the request is to be retried, then OnWebHookRetry is called enabling additional post-processing of a retry request.
protected OnWebHookRetry ( WebHookWorkItem workItem ) : System.Threading.Tasks.Task
workItem WebHookWorkItem The current .
Результат System.Threading.Tasks.Task

OnWebHookSuccess() защищенный Метод

If delivery of a WebHook is successful, i.e. a 2xx HTTP status code is received, then OnWebHookSuccess is called enabling additional post-processing.
protected OnWebHookSuccess ( WebHookWorkItem workItem ) : System.Threading.Tasks.Task
workItem WebHookWorkItem The current .
Результат System.Threading.Tasks.Task

SendWebHookWorkItemsAsync() публичный Метод

public SendWebHookWorkItemsAsync ( IEnumerable workItems ) : System.Threading.Tasks.Task
workItems IEnumerable
Результат System.Threading.Tasks.Task