Table of Contents

Class ConnectionReclaimerHostedService

Namespace
Virtufin.WebSocketManager.Services
Assembly
Virtufin.WebSocketManager.dll

Background service that periodically reclaims connections from dead instances. Prevents connection orphaning when pods are replaced via rolling update.

public sealed class ConnectionReclaimerHostedService : BackgroundService, IHostedService, IDisposable
Inheritance
ConnectionReclaimerHostedService
Implements
Inherited Members

Constructors

ConnectionReclaimerHostedService(IDaprConnectionRepository, IInstanceIdProvider, IWebSocketConnectionStore, ILogger<ConnectionReclaimerHostedService>)

Creates a new ConnectionReclaimerHostedService.

public ConnectionReclaimerHostedService(IDaprConnectionRepository repository, IInstanceIdProvider instanceIdProvider, IWebSocketConnectionStore connectionStore, ILogger<ConnectionReclaimerHostedService> logger)

Parameters

repository IDaprConnectionRepository
instanceIdProvider IInstanceIdProvider
connectionStore IWebSocketConnectionStore
logger ILogger<ConnectionReclaimerHostedService>

Methods

ExecuteAsync(CancellationToken)

This method is called when the IHostedService starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed.

protected override Task ExecuteAsync(CancellationToken stoppingToken)

Parameters

stoppingToken CancellationToken

Triggered when StopAsync(CancellationToken) is called.

Returns

Task

A Task that represents the long running operations.

Remarks

See Worker Services in .NET for implementation guidelines.