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.

50 lines
1.3KB

  1. using HealthMonitor.Service.Resolver.Interface;
  2. using HealthMonitor.Service.Sub;
  3. using HealthMonitor.Service.Sub.Interface;
  4. using System.Collections.Concurrent;
  5. namespace HealthMonitor.WebApi
  6. {
  7. public class PackageProcess : IDisposable
  8. {
  9. private readonly ILogger<PackageProcess> _logger;
  10. private readonly MsgQueueManager _msgQueueManager;
  11. public PackageProcess(ILogger<PackageProcess> logger, MsgQueueManager msgQueueManager)
  12. {
  13. _logger = logger;
  14. _msgQueueManager = msgQueueManager;
  15. }
  16. public async Task<bool> ResolveAsync()
  17. {
  18. var resolver = _msgQueueManager.GetMsgResolver();
  19. try
  20. {
  21. if (resolver != null)
  22. {
  23. await resolver.ExecuteMessageAsync().ConfigureAwait(false);
  24. }
  25. }
  26. catch (Exception ex)
  27. {
  28. Console.WriteLine(ex.Message);
  29. //_logger.LogError($"[{msg.MessageId}] 未处理异常 message: {ex.Message}\n {ex.StackTrace}");
  30. }
  31. return true;
  32. }
  33. public void Dispose()
  34. {
  35. throw new NotImplementedException();
  36. }
  37. }
  38. }