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.

58 lines
1.5KB

  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 MsgManager
  13. {
  14. private readonly BloodpressResolver _resolver;
  15. private readonly ILogger<MsgManager> _logger;
  16. private PackageMsgModel _msg = default!;
  17. public MsgManager(ILogger<MsgManager> logger, BloodpressResolver resolver)
  18. {
  19. _logger = logger;
  20. _resolver = resolver;
  21. }
  22. public void EnqueueMsg(PackageMsgModel msg)
  23. {
  24. _msg = msg;
  25. Console.WriteLine($"GetMsgResolver-{_msg.MessageId}");
  26. }
  27. public IResolver? GetMsgResolver()
  28. {
  29. if (_msg == null)
  30. {
  31. return null;
  32. }
  33. Console.WriteLine($"GetMsgResolver-{_msg.MessageId}");
  34. _resolver.SetResolveInfo(_msg);
  35. _msg = default!;
  36. return _resolver;
  37. }
  38. //public IResolver? GetMsgResolver(PackageMsgModel msg)
  39. //{
  40. // if (_msg == null)
  41. // {
  42. // return null;
  43. // }
  44. // Console.WriteLine($"GetMsgResolver-{_msg.MessageId}");
  45. // _resolver.SetResolveInfo(msg);
  46. // _msg = default!;
  47. // return _resolver;
  48. //}
  49. }
  50. }