Exemple #1
0
        public override async Task EnableMethodsAsync(CancellationToken cancellationToken)
        {
            if (Logging.IsEnabled)
            {
                Logging.Enter(this, cancellationToken, $"{nameof(EnableMethodsAsync)}");
            }

            try
            {
                cancellationToken.ThrowIfCancellationRequested();

                await _amqpUnit.EnableMethodsAsync(_operationTimeout).ConfigureAwait(false);
            }
            catch (Exception exception) when(!exception.IsFatal() && !(exception is OperationCanceledException))
            {
                throw AmqpClientHelper.ToIotHubClientContract(exception);
            }
            finally
            {
                if (Logging.IsEnabled)
                {
                    Logging.Exit(this, cancellationToken, $"{nameof(EnableMethodsAsync)}");
                }
            }
        }
Exemple #2
0
        public override async Task EnableMethodsAsync(CancellationToken cancellationToken)
        {
            Logging.Enter(this, cancellationToken, nameof(EnableMethodsAsync));

            try
            {
                cancellationToken.ThrowIfCancellationRequested();

                await _amqpUnit.EnableMethodsAsync(_operationTimeout).ConfigureAwait(false);
            }
            finally
            {
                Logging.Exit(this, cancellationToken, nameof(EnableMethodsAsync));
            }
        }
        public override async Task EnableMethodsAsync(CancellationToken cancellationToken)
        {
            if (Logging.IsEnabled)
            {
                Logging.Enter(this, cancellationToken, nameof(EnableMethodsAsync));
            }

            try
            {
                cancellationToken.ThrowIfCancellationRequested();
                using var ctb = new CancellationTokenBundle(_operationTimeout, cancellationToken);

                await _amqpUnit.EnableMethodsAsync(ctb.Token).ConfigureAwait(false);
            }
            finally
            {
                if (Logging.IsEnabled)
                {
                    Logging.Exit(this, cancellationToken, nameof(EnableMethodsAsync));
                }
            }
        }