private void Consumer() { _logger?.LogInformation($"Start {Name}."); _status = true; while (!_cancellationTokenSource.IsCancellationRequested) { ProcessQueue(); try { _eventSlim.Wait(_cancellationTokenSource.Token); _eventSlim.Reset(); } catch (OperationCanceledException) { // expected _logger?.LogWarning("AsyncQueueDispatcher cancel."); break; } } ProcessQueue(); // one last time for the remaining messages }
public bool Push(IPayload payload) { if (!_payloadDispatcher.Dispatch(payload)) { _logger?.LogWarning("Couldn't dispatch payload, actor may be blocked by another operation."); return(false); } return(true); }