Class DataPipelineBackgroundService
- Namespace
- FoundationaLLM.DataPipelineEngine.Services
- Assembly
- FoundationaLLM.DataPipelineEngine.dll
Provides capabilities for data pipeline services that run in the background.
public class DataPipelineBackgroundService : BackgroundService, IHostedService, IDisposable, IResourceProviderClient
- Inheritance
-
DataPipelineBackgroundService
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
DataPipelineBackgroundService(TimeSpan, IServiceProvider, ILogger)
Provides capabilities for data pipeline services that run in the background.
public DataPipelineBackgroundService(TimeSpan executionCycleInterval, IServiceProvider serviceProvider, ILogger logger)
Parameters
executionCycleInterval
TimeSpanThe time interval between two successive execution cycles.
serviceProvider
IServiceProviderThe service collection provided by the dependency injection container.
logger
ILoggerThe logger used for logging.
Fields
_dataPipelineResourceProvider
protected IResourceProviderService _dataPipelineResourceProvider
Field Value
_initializationTask
protected Task<bool> _initializationTask
Field Value
_logger
protected readonly ILogger _logger
Field Value
_pluginService
protected IPluginService _pluginService
Field Value
_serviceProvider
protected readonly IServiceProvider _serviceProvider
Field Value
Properties
ResourceProviders
Sets the resource providers collection.
public IEnumerable<IResourceProviderService> ResourceProviders { set; }
Property Value
Remarks
This property must be exposed by services that cannot be injected with the resource providers. These are background services that both provide and consume services to and from the resource providers.
ServiceName
protected virtual string ServiceName { get; }
Property Value
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.
ExecuteAsyncInternal(CancellationToken)
Executes the background service's main logic.
protected virtual Task ExecuteAsyncInternal(CancellationToken stoppingToken)
Parameters
stoppingToken
CancellationTokenThe cancellation token used to signal a request to stop the service.
Returns
InitializeAsyncInternal(CancellationToken)
Performs additional initialization for the background service.
protected virtual Task InitializeAsyncInternal(CancellationToken stoppingToken)
Parameters
stoppingToken
CancellationTokenThe cancellation token used to signal a request to stop the service.
Returns
SetResourceProviders(IEnumerable<IResourceProviderService>)
Implements additional resource provider initialization.
protected virtual void SetResourceProviders(IEnumerable<IResourceProviderService> resourceProviders)
Parameters
resourceProviders
IEnumerable<IResourceProviderService>The collection of resource providers available in the main dependency injection container.