电子围栏推送服务
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.

26 lines
700B

  1. using TelpoPush.Fence.Worker.Handlers;
  2. namespace TelpoPush.Fence.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. }