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
IVectorizationStateServiceThe IVectorizationStateService used to manage the vectorization state.
settings
IOptions<VectorizationWorkerSettings>The VectorizationWorkerSettings options holding the vectorization worker settings.
queuesConfigurationSection
IConfigurationSectionThe IConfigurationSection containing settings for the queues.
stepsConfigurationSection
IConfigurationSectionThe IConfigurationSection containing settings for the vectorization steps.
serviceProvider
IServiceProviderThe IServiceProvider implemented by the dependency injection container.
loggerFactory
ILoggerFactoryThe 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
CancellationTokenTriggered when StopAsync(CancellationToken) is called.
Returns
Remarks
See Worker Services in .NET for implementation guidelines.