|
12345678910111213141516171819202122232425262728 |
- using Microsoft.Extensions.Logging;
- using TelpoPush.Worker.ThirdSsl.Handlers;
-
- namespace TelpoPush.Worker.ThirdSsl
- {
- public class Worker : BackgroundService
- {
- private readonly IHostEnvironment _env;
- private readonly ILogger<Worker> _logger;
- KafkaSubscribe _kafkaSubscribe;
-
- public Worker(ILogger<Worker> 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);
- }
- }
- }
- }
|