using Microsoft.Extensions.Logging; using TelpoPush.Worker.ThirdSsl.Handlers; namespace TelpoPush.Worker.ThirdSsl { public class Worker : BackgroundService { private readonly IHostEnvironment _env; private readonly ILogger _logger; KafkaSubscribe _kafkaSubscribe; public Worker(ILogger logger, IHostEnvironment env, KafkaSubscribe kafkaSubscribe) { _env = env; _logger = logger; _kafkaSubscribe = kafkaSubscribe; } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { await _kafkaSubscribe.SubscribeAsync(); //await Task.Delay(30000, stoppingToken); } } } }