Table of Contents

Class InstanceRecoveryService

Namespace
Bielu.Microservices.Orchestrator.Storage
Assembly
Bielu.Microservices.Orchestrator.dll

Hosted service that runs on startup to reconcile the desired state in the IInstanceStore with the actual state of containers in the runtime.

public class InstanceRecoveryService : BackgroundService, IHostedService, IDisposable
Inheritance
InstanceRecoveryService
Implements
Inherited Members

Constructors

InstanceRecoveryService(IInstanceStore, IContainerManager, ILogger<InstanceRecoveryService>)

Hosted service that runs on startup to reconcile the desired state in the IInstanceStore with the actual state of containers in the runtime.

public InstanceRecoveryService(IInstanceStore instanceStore, IContainerManager containerManager, ILogger<InstanceRecoveryService> logger)

Parameters

instanceStore IInstanceStore
containerManager IContainerManager
logger ILogger<InstanceRecoveryService>

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.

ReconcileAllAsync(CancellationToken)

Performs the reconciliation of all managed instances in the store with the runtime. Public to allow unit testing without blocking the host startup.

public Task ReconcileAllAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task