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.

46 lines
1.1KB

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