public override async Task SendMethodResponseAsync(MethodResponseInternal methodResponse, CancellationToken cancellationToken) { if (Logging.IsEnabled) { Logging.Enter(this, methodResponse, cancellationToken, $"{nameof(SendMethodResponseAsync)}"); } try { cancellationToken.ThrowIfCancellationRequested(); Outcome outcome; using (AmqpMessage amqpMessage = methodResponse.ToAmqpMessage()) { outcome = await _amqpUnit.SendMethodResponseAsync(amqpMessage, _operationTimeout).ConfigureAwait(false); } if (outcome.DescriptorCode != Accepted.Code) { throw AmqpErrorMapper.GetExceptionFromOutcome(outcome); } } finally { if (Logging.IsEnabled) { Logging.Exit(this, methodResponse, cancellationToken, $"{nameof(SendMethodResponseAsync)}"); } } }
public override async Task SendMethodResponseAsync(MethodResponseInternal methodResponse, CancellationToken cancellationToken) { await this.HandleTimeoutCancellation(async() => { Outcome outcome; using (AmqpMessage amqpMessage = methodResponse.ToAmqpMessage()) { outcome = await this.SendAmqpMethodResponseAsync(amqpMessage, cancellationToken); } if (outcome.DescriptorCode != Accepted.Code) { throw AmqpErrorMapper.GetExceptionFromOutcome(outcome); } }, cancellationToken); }