Search documentationEsc

CosmosRepositoryChangeFeedHostedService

A `BackgroundService` to start and stop the `IChangeFeedService`

Namespace: Microsoft.Azure.CosmosRepository.AspNetCore
Kind: class

A BackgroundService to start and stop the IChangeFeedService

public class CosmosRepositoryChangeFeedHostedService : BackgroundService, IHostedService, IDisposable

Remarks

Creates an instance of the CosmosRepositoryChangeFeedHostedService

Example

Members

Constructor

CosmosRepositoryChangeFeedHostedService.CosmosRepositoryChangeFeedHostedService(IChangeFeedService)

A BackgroundService to start and stop the IChangeFeedService

public CosmosRepositoryChangeFeedHostedService(IChangeFeedService changeFeedService)

Parameters

NameTypeDescription
changeFeedServiceIChangeFeedServiceThe IChangeFeedService to start.

Creates an instance of the CosmosRepositoryChangeFeedHostedService

Methods

CosmosRepositoryChangeFeedHostedService.StartAsync(CancellationToken)

Starts the IChangeFeedService.

public override Task StartAsync(CancellationToken cancellationToken)

Parameters

NameTypeDescription
cancellationTokenCancellationToken

ReturnsTask

CosmosRepositoryChangeFeedHostedService.StopAsync(CancellationToken)

Stops the IChangeFeedService.

public override Task StopAsync(CancellationToken cancellationToken)

Parameters

NameTypeDescription
cancellationTokenCancellationToken

ReturnsTask

CosmosRepositoryChangeFeedHostedService.ExecuteAsync(CancellationToken)

Background execution is not used because startup and shutdown are explicitly delegated to the IChangeFeedService.

protected override Task ExecuteAsync(CancellationToken stoppingToken)

Parameters

NameTypeDescription
stoppingTokenCancellationToken

ReturnsTask