Table of Contents

Class Worker

Namespace
FoundationaLLM.Vectorization.Worker
Assembly
FoundationaLLM.Vectorization.Worker.dll

The background service used to run the worker.

public class Worker : BackgroundService, IHostedService, IDisposable
Inheritance
Worker
Implements
Inherited Members
Extension Methods

Remarks

Creates a new instance of the worker.

Constructors

Worker(IVectorizationStateService, IOptions<VectorizationWorkerSettings>, IConfigurationSection, IConfigurationSection, IServiceProvider, ILoggerFactory)

The background service used to run the worker.

public Worker(IVectorizationStateService stateService, IOptions<VectorizationWorkerSettings> settings, IConfigurationSection queuesConfigurationSection, IConfigurationSection stepsConfigurationSection, IServiceProvider serviceProvider, ILoggerFactory loggerFactory)

Parameters

stateService IVectorizationStateService

The IVectorizationStateService used to manage the vectorization state.

settings IOptions<VectorizationWorkerSettings>

The VectorizationWorkerSettings options holding the vectorization worker settings.

queuesConfigurationSection IConfigurationSection

The IConfigurationSection containing settings for the queues.

stepsConfigurationSection IConfigurationSection

The IConfigurationSection containing settings for the vectorization steps.

serviceProvider IServiceProvider

The IServiceProvider implemented by the dependency injection container.

loggerFactory ILoggerFactory

The ILoggerFactory used to create loggers in child objects.

Remarks

Creates a new instance of the worker.

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.