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.

MsgQueueManager.cs 953B

1 yıl önce
1 yıl önce
1234567891011121314151617181920212223242526272829303132333435
  1. using HealthMonitor.Service.Resolver;
  2. using HealthMonitor.Service.Resolver.Interface;
  3. using Microsoft.Extensions.Logging;
  4. using System;
  5. using System.Collections.Concurrent;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace HealthMonitor.Service.Sub
  11. {
  12. public class MsgQueueManager: ConcurrentQueue<PackageMsgModel>
  13. {
  14. private readonly ILogger<MsgQueueManager> _logger;
  15. private readonly BloodpressResolver _resolver;
  16. public MsgQueueManager(ILogger<MsgQueueManager> logger, BloodpressResolver resolver)
  17. {
  18. _logger = logger;
  19. _resolver = resolver;
  20. }
  21. public IResolver? GetMsgResolver()
  22. {
  23. TryDequeue(out var msg);
  24. if (msg == null)
  25. {
  26. return null;
  27. }
  28. _resolver.SetResolveInfo(msg);
  29. return _resolver;
  30. }
  31. }
  32. }