C# Class Microsoft.AspNet.WebHooks.AzureWebHookDequeueManager

Provides an event loop which dequeues messages from a Microsoft Azure Queue and then sends the WebHook to the recipients. If the delivery success then the message is removed from the queue, otherwise it remains so that another attempt can be made. After a given number of attempts the message is discarded without being delivered.
Inheritance: IDisposable
Mostra file Open project: aspnet/WebHooks Class Usage Examples

Private Properties

Property Type Description
AzureWebHookDequeueManager System

Public Methods

Method Description
AzureWebHookDequeueManager ( string connectionString, ILogger logger ) : System

Initializes a new instance of the AzureWebHookDequeueManager using the given connectionString to identify the Microsoft Azure Storage Queue.

AzureWebHookDequeueManager ( string connectionString, ILogger logger, System.TimeSpan pollingFrequency, System.TimeSpan messageTimeout, int maxAttempts ) : System

Initializes a new instance of the AzureWebHookDequeueManager using the given connectionString to identify the Microsoft Azure Storage Queue.

Dispose ( ) : void
Start ( CancellationToken cancellationToken ) : Task

Start the event loop of requesting messages from the queue and send them out as WebHooks.

Protected Methods

Method Description
DequeueAndSendWebHooks ( CancellationToken cancellationToken ) : Task

Dequeues available WebHooks and sends them out to each WebHook recipient.

Dispose ( bool disposing ) : void

Private Methods

Method Description
AzureWebHookDequeueManager ( string connectionString, ILogger logger, System.TimeSpan pollingFrequency, System.TimeSpan messageTimeout, int maxAttempts, HttpClient httpClient, IStorageManager storageManager, WebHookSender sender ) : System

Intended for unit test purposes

Method Details

AzureWebHookDequeueManager() public method

Initializes a new instance of the AzureWebHookDequeueManager using the given connectionString to identify the Microsoft Azure Storage Queue.
public AzureWebHookDequeueManager ( string connectionString, ILogger logger ) : System
connectionString string The Microsoft Azure Storage Queue connection string.
logger ILogger The instance to use for logging errors and warnings.
return System

AzureWebHookDequeueManager() public method

Initializes a new instance of the AzureWebHookDequeueManager using the given connectionString to identify the Microsoft Azure Storage Queue.
public AzureWebHookDequeueManager ( string connectionString, ILogger logger, System.TimeSpan pollingFrequency, System.TimeSpan messageTimeout, int maxAttempts ) : System
connectionString string The Microsoft Azure Storage Queue connection string.
logger ILogger The instance to use for logging errors and warnings.
pollingFrequency System.TimeSpan The polling frequency by which we request messages from the queue.
messageTimeout System.TimeSpan The time allotted to send out the WebHooks request and get a response. If /// the request has not completed within this time frame, the message will be considered to have failed and /// it will be attempted again.
maxAttempts int The maximum number of attempts to deliver the WebHook.
return System

DequeueAndSendWebHooks() protected method

Dequeues available WebHooks and sends them out to each WebHook recipient.
protected DequeueAndSendWebHooks ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken
return Task

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

Start() public method

Start the event loop of requesting messages from the queue and send them out as WebHooks.
public Start ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken A which can be used to terminate the event loop.
return Task