|
- using TelpoPush.Fence.Worker.Handlers;
-
- namespace TelpoPush.Fence.Worker
- {
- public class Worker : BackgroundService
- {
- private readonly ILogger<Worker> _logger;
- KafkaSubscribe _kafkaSubscribe;
-
- public Worker(ILogger<Worker> logger, KafkaSubscribe kafkaSubscribe)
- {
- _logger = logger;
- _kafkaSubscribe = kafkaSubscribe;
- }
-
- protected override async Task ExecuteAsync(CancellationToken stoppingToken)
- {
- while (!stoppingToken.IsCancellationRequested)
- {
- await _kafkaSubscribe.SubscribeAsync();
- await Task.Delay(1000, stoppingToken);
- }
- }
- }
- }
|