No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

64 líneas
1.7KB

  1. using HealthMonitor.Service.Resolver;
  2. using HealthMonitor.Service.Resolver.Interface;
  3. using HealthMonitor.Service.Sub.Topic.Model;
  4. using Microsoft.Extensions.Logging;
  5. using System;
  6. using System.Collections.Concurrent;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace HealthMonitor.Service.Sub
  12. {
  13. public class MsgQueueManager: ConcurrentQueue<PackageMsgModel>
  14. {
  15. private readonly ILogger<MsgQueueManager> _logger;
  16. private readonly BloodpressResolver _resolverBloodpress;
  17. //private const string BP = nameof(TopicHmBloodPress).ToLower();
  18. public MsgQueueManager(ILogger<MsgQueueManager> logger, BloodpressResolver resolverBloodpress)
  19. {
  20. _logger = logger;
  21. _resolverBloodpress = resolverBloodpress;
  22. }
  23. //public IResolver? GetMsgResolver()
  24. //{
  25. // TryDequeue(out var msg);
  26. // if (msg == null)
  27. // {
  28. // return null;
  29. // }
  30. // _resolver.SetResolveInfo(msg);
  31. // return _resolver;
  32. //}
  33. public IResolver? GetMsgResolver(PackageMsgModel msg)
  34. {
  35. if (msg == null) return null;
  36. //switch (msg.Topic)
  37. //{
  38. // case BP:
  39. // _resolverBloodpress.SetResolveInfo(msg);
  40. // return _resolverBloodpress;
  41. // default:
  42. // return null;
  43. //}
  44. if (msg.Topic.Equals(nameof(TopicHmBloodPress).ToLower()))
  45. {
  46. _resolverBloodpress.SetResolveInfo(msg);
  47. return _resolverBloodpress;
  48. }
  49. return null;
  50. }
  51. }
  52. }