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.

49 satır
1.2KB

  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. _logger.LogError($"未处理异常 message: {ex.Message}\n {ex.StackTrace}");
  29. }
  30. return true;
  31. }
  32. public void Dispose()
  33. {
  34. throw new NotImplementedException();
  35. }
  36. }
  37. }