protected override Task StopSupervisor(StopSupervisorContext context) { if (_log.IsDebugEnabled) _log.DebugFormat("Stopping transport: {0}", _exchange); return base.StopSupervisor(context); }
protected virtual async Task StopSupervisor(StopSupervisorContext context) { if (context.Agents.Length == 0) { SetCompleted(TaskUtil.Completed); } if (context.Agents.Length == 1) { SetCompleted(context.Agents[0].Completed); await context.Agents[0].Stop(context).UntilCompletedOrCanceled(context.CancellationToken).ConfigureAwait(false); } else if (context.Agents.Length > 1) { Task[] completedTasks = new Task[context.Agents.Length]; for (int i = 0; i < context.Agents.Length; i++) { completedTasks[i] = context.Agents[i].Completed; } SetCompleted(Task.WhenAll(completedTasks)); Task[] stopTasks = new Task[context.Agents.Length]; for (int i = 0; i < context.Agents.Length; i++) { stopTasks[i] = context.Agents[i].Stop(context); } await Task.WhenAll(stopTasks).UntilCompletedOrCanceled(context.CancellationToken).ConfigureAwait(false); } await Completed.UntilCompletedOrCanceled(context.CancellationToken).ConfigureAwait(false); }
async Task ActiveAndActualAgentsCompleted(StopSupervisorContext context) { await Task.WhenAll(context.Agents.Select(x => Completed)).UntilCompletedOrCanceled(context.CancellationToken).ConfigureAwait(false); if (_tracker.ActiveDeliveryCount > 0) { try { await _deliveryComplete.Task.UntilCompletedOrCanceled(context.CancellationToken).ConfigureAwait(false); } catch (OperationCanceledException) { if (_log.IsWarnEnabled) { _log.WarnFormat("Stop canceled waiting for message consumers to complete: {0}", _context.InputAddress); } } } try { _messageConsumer.Close(); _messageConsumer.Dispose(); } catch (OperationCanceledException) { if (_log.IsWarnEnabled) { _log.WarnFormat("Exception canceling the consumer: {0}", _context.InputAddress); } } }
async Task ActiveAndActualAgentsCompleted(StopSupervisorContext context) { await Task.WhenAll(context.Agents.Select(x => Completed)).OrCanceled(context.CancellationToken).ConfigureAwait(false); if (_dispatcher.ActiveDispatchCount > 0) { try { await _deliveryComplete.Task.OrCanceled(context.CancellationToken).ConfigureAwait(false); } catch (OperationCanceledException) { LogContext.Warning?.Log("Stop canceled waiting for message consumers to complete: {InputAddress}", _context.InputAddress); } } try { _messageConsumer.Close(); _messageConsumer.Dispose(); } catch (OperationCanceledException) { LogContext.Warning?.Log("Stop canceled waiting for consumer shutdown: {InputAddress}", _context.InputAddress); } }
async Task ActiveAndActualAgentsCompleted(StopSupervisorContext context) { await Task.WhenAll(context.Agents.Select(x => Completed)).OrCanceled(context.CancellationToken).ConfigureAwait(false); if (_tracker.ActiveDeliveryCount > 0) { try { await _deliveryComplete.Task.OrCanceled(context.CancellationToken).ConfigureAwait(false); } catch (OperationCanceledException) { LogContext.Warning?.Log("Stop canceled waiting for message consumers to complete: {InputAddress} - {ConsumerTag}", _context.InputAddress, _consumerTag); } } try { await _model.BasicCancel(_consumerTag).ConfigureAwait(false); } catch (OperationCanceledException) { LogContext.Warning?.Log("Stop canceled waiting for consumer cancellation: {InputAddress} - {ConsumerTag}", _context.InputAddress, _consumerTag); } }
protected virtual async Task StopSupervisor(StopSupervisorContext context) { SetCompleted(Task.WhenAll(context.Agents.Select(x => x.Completed))); await Task.WhenAll(context.Agents.Select(x => x.Stop(context))).UntilCompletedOrCanceled(context.CancellationToken).ConfigureAwait(false); await Completed.UntilCompletedOrCanceled(context.CancellationToken).ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { await _consumeSupervisor.Stop(context).ConfigureAwait(false); await _sendSupervisor.Stop(context).ConfigureAwait(false); await base.StopSupervisor(context).ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { LogContext.Debug?.Log("Stopping consumer: {InputAddress}", _context.InputAddress); SetCompleted(ActiveAndActualAgentsCompleted(context)); await Completed.ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { await base.StopSupervisor(context).ConfigureAwait(false); await NamespaceContextSupervisor.Stop(context).ConfigureAwait(false); await MessagingFactoryContextSupervisor.Stop(context).ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { if (_log.IsDebugEnabled) _log.DebugFormat("Stopping consumer: {0}", _context.InputAddress); SetCompleted(ActiveAndActualAgentsCompleted(context)); await Completed.ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { await base.StopSupervisor(context).ConfigureAwait(false); foreach (var agent in GetAgentHandles()) { await agent.Stop(context).ConfigureAwait(false); } }
protected override Task StopSupervisor(StopSupervisorContext context) { if (_log.IsDebugEnabled) { _log.DebugFormat("Stopping transport: {0}", _address); } return(base.StopSupervisor(context)); }
protected override async Task StopSupervisor(StopSupervisorContext context) { await base.StopSupervisor(context).ConfigureAwait(false); if (_messageFabric.IsValueCreated) { await _messageFabric.Value.DisposeAsync().ConfigureAwait(false); } }
protected override async Task StopSupervisor(StopSupervisorContext context) { LogContext.Debug?.Log("Stopping receiver: {InputAddress}", _context.InputAddress); SetCompleted(ActiveAndActualAgentsCompleted(context)); await Completed.ConfigureAwait(false); await _context.CloseAsync(context.CancellationToken).ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { SetCompleted(ActiveAndActualAgentsCompleted(context)); // stop the active context agents await _activeSupervisor.Stop(context).ConfigureAwait(false); await Task.WhenAll(context.Agents.Select(x => x.Stop(context))).OrCanceled(context.CancellationToken).ConfigureAwait(false); await Completed.OrCanceled(context.CancellationToken).ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { LogContext.Debug?.Log("gRPC Stopping: {HostAddress}", HostAddress); await base.StopSupervisor(context).ConfigureAwait(false); var shutdownAsync = _server.ShutdownAsync(); await shutdownAsync.ConfigureAwait(false); await _messageFabric.Stop(context).ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { if (_log.IsDebugEnabled) { _log.DebugFormat("Stopping receiver: {0}", _context.InputAddress); } SetCompleted(ActiveAndActualAgentsCompleted(context)); await Completed.ConfigureAwait(false); await _context.CloseAsync(context.CancellationToken).ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { LogContext.Debug?.Log("Stopping Consumer: {InputAddress} - {ConsumerTag}", _context.InputAddress, _consumerTag); SetCompleted(ActiveAndActualAgentsCompleted(context)); try { await Completed.ConfigureAwait(false); } catch (OperationCanceledException) { foreach (var pendingContext in _pending.Values) { pendingContext.Cancel(); } throw; } }
protected override async Task StopSupervisor(StopSupervisorContext context) { if (_log.IsDebugEnabled) { _log.DebugFormat("Stopping consumer: {0}", _receiveEndpointContext.InputAddress); } SetCompleted(ActiveAndActualAgentsCompleted(context)); try { await Completed.UntilCompletedOrTimeout(TimeSpan.FromSeconds(30)).ConfigureAwait(false); } catch (TimeoutException) { foreach (var pendingContext in _pending.Values) { pendingContext.Cancel(); } } await Completed.ConfigureAwait(false); }
protected override Task StopSupervisor(StopSupervisorContext context) { LogContext.Debug?.Log("Stopping send transport: {Topic}", _context.EntityName); return(base.StopSupervisor(context)); }
protected override Task StopSupervisor(StopSupervisorContext context) { LogContext.Debug?.Log("Stopping send transport: {Exchange}", _context.Exchange); return(base.StopSupervisor(context)); }
async Task ActiveAndActualAgentsCompleted(StopSupervisorContext context) { await _activeSupervisor.Completed.ConfigureAwait(false); await Task.WhenAll(context.Agents.Select(x => x.Completed)).ConfigureAwait(false); }
protected override Task StopSupervisor(StopSupervisorContext context) { TransportLogMessages.StoppingSendTransport(_context.EntityName); return(base.StopSupervisor(context)); }
protected override Task StopSupervisor(StopSupervisorContext context) { LogContext.Debug?.Log("Stopping Transport: {Address}", _address); return(base.StopSupervisor(context)); }
protected override async Task StopSupervisor(StopSupervisorContext context) { await _receiveEndpoints.Stop(context).ConfigureAwait(false); await base.StopSupervisor(context).ConfigureAwait(false); }
protected override async Task StopSupervisor(StopSupervisorContext context) { await base.StopSupervisor(context).ConfigureAwait(false); await ConnectionContextSupervisor.Stop(context).ConfigureAwait(false); }