万佳安设备数据
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Worker.cs 706B

3 ay önce
12345678910111213141516171819202122232425
  1. using TelpoPush.WanJiaAn.Worker.Handlers;
  2. namespace TelpoPush.WanJiaAn.Worker
  3. {
  4. public class Worker : BackgroundService
  5. {
  6. private readonly ILogger<Worker> _logger;
  7. KafkaSubscribe _kafkaSubscribe;
  8. public Worker(ILogger<Worker> logger, KafkaSubscribe kafkaSubscribe)
  9. {
  10. _logger = logger;
  11. _kafkaSubscribe = kafkaSubscribe;
  12. }
  13. protected override async Task ExecuteAsync(CancellationToken stoppingToken)
  14. {
  15. while (!stoppingToken.IsCancellationRequested)
  16. {
  17. await _kafkaSubscribe.SubscribeAsync();
  18. await Task.Delay(1000, stoppingToken);
  19. }
  20. }
  21. }
  22. }