C# Class 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.
Inheritance: WebHookSender
Mostra file Open project: aspnet/WebHooks Class Usage Examples

Public Methods

Method Description
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

Protected Methods

Method Description
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.

Private Methods

Method Description
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.

Method Details

DataflowWebHookSender() public method

Initializes a new instance of the DataflowWebHookSender class with a default retry policy.
public DataflowWebHookSender ( ILogger logger ) : System
logger ILogger The current .
return System

DataflowWebHookSender() public method

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.
return System

Dispose() protected method

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.
return void

OnWebHookFailure() protected method

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 .
return System.Threading.Tasks.Task

OnWebHookGone() protected method

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 .
return System.Threading.Tasks.Task

OnWebHookRetry() protected method

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 .
return System.Threading.Tasks.Task

OnWebHookSuccess() protected method

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 .
return System.Threading.Tasks.Task

SendWebHookWorkItemsAsync() public method

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