Browse Source

Fixed asynchronous exception catching bug of sending.

master
Savorboard 5 years ago
parent
commit
d1c26b75bd
1 changed files with 8 additions and 8 deletions
  1. +8
    -8
      src/DotNetCore.CAP/Processor/IDispatcher.Default.cs

+ 8
- 8
src/DotNetCore.CAP/Processor/IDispatcher.Default.cs View File

@@ -59,17 +59,17 @@ namespace DotNetCore.CAP.Processor
{
if (_publishedMessageQueue.TryTake(out var message, 3000, _cts.Token))
{
try
Task.Run(async () =>
{
Task.Run(async () =>
try
{
await _sender.SendAsync(message);
});
}
catch (Exception ex)
{
_logger.LogError(ex, $"An exception occurred when sending a message to the MQ. Topic:{message.Name}, Id:{message.Id}");
}
}
catch (Exception ex)
{
_logger.LogError(ex, $"An exception occurred when sending a message to the MQ. Topic:{message.Name}, Id:{message.Id}");
}
});
}
}
}


Loading…
Cancel
Save