Class KafkaBackgroundService
Inherited Members
Namespace: NotifyHub.NotificationService.Infrastructure.Workers
Assembly: NotifyHub.NotificationService.Infrastructure.dll
Syntax
public class KafkaBackgroundService : BackgroundService, IHostedService, IDisposable
Constructors
| Edit this page View SourceKafkaBackgroundService(ILogger<KafkaBackgroundService>, IKafkaConsumer<NotificationMessageDto>, IKafkaProducer<NotificationMessageDto>, IServiceScopeFactory)
Declaration
public KafkaBackgroundService(ILogger<KafkaBackgroundService> logger, IKafkaConsumer<NotificationMessageDto> consumer, IKafkaProducer<NotificationMessageDto> producer, IServiceScopeFactory scopeFactory)
Parameters
Type | Name | Description |
---|---|---|
ILogger<KafkaBackgroundService> | logger | |
IKafkaConsumer<NotificationMessageDto> | consumer | |
IKafkaProducer<NotificationMessageDto> | producer | |
IServiceScopeFactory | scopeFactory |
Methods
| Edit this page View SourceExecuteAsync(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.
Declaration
protected override Task ExecuteAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A Task that represents the long running operations. |
Overrides
Remarks
See Worker Services in .NET for implementation guidelines.