public override async Task EnableEventReceiveAsync(bool isAnEdgeModule, CancellationToken cancellationToken)
        {
            // If an AMQP transport is opened as a module twin instead of an Edge module we need
            // to enable the deviceBound operations instead of the event receiver link
            if (isAnEdgeModule)
            {
                if (Logging.IsEnabled)
                {
                    Logging.Enter(this, cancellationToken, nameof(EnableEventReceiveAsync));
                }

                try
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    using var ctb = new CancellationTokenBundle(_operationTimeout, cancellationToken);

                    await _amqpUnit.EnableEventReceiveAsync(ctb.Token).ConfigureAwait(false);
                }
                finally
                {
                    if (Logging.IsEnabled)
                    {
                        Logging.Exit(this, cancellationToken, nameof(EnableEventReceiveAsync));
                    }
                }
            }
            else
            {
                await EnableReceiveMessageAsync(cancellationToken).ConfigureAwait(false);
            }
        }
Exemple #2
0
        public override async Task EnableEventReceiveAsync(CancellationToken cancellationToken)
        {
            Logging.Enter(this, cancellationToken, nameof(EnableEventReceiveAsync));

            try
            {
                cancellationToken.ThrowIfCancellationRequested();

                await _amqpUnit.EnableEventReceiveAsync(_operationTimeout).ConfigureAwait(false);
            }
            finally
            {
                Logging.Exit(this, cancellationToken, nameof(EnableEventReceiveAsync));
            }
        }