Exemple #1
0
        public override async Task SendEventAsync(IEnumerable <Message> messages, CancellationToken cancellationToken)
        {
            Logging.Enter(this, messages, cancellationToken, nameof(SendEventAsync));

            try
            {
                cancellationToken.ThrowIfCancellationRequested();

                await _amqpUnit.SendEventsAsync(messages, _operationTimeout).ConfigureAwait(false);
            }
            finally
            {
                Logging.Exit(this, messages, cancellationToken, nameof(SendEventAsync));
            }
        }
        public override async Task SendEventAsync(IEnumerable <Message> messages, CancellationToken cancellationToken)
        {
            if (Logging.IsEnabled)
            {
                Logging.Enter(this, messages, cancellationToken, nameof(SendEventAsync));
            }

            try
            {
                cancellationToken.ThrowIfCancellationRequested();

                using var ctb = new CancellationTokenBundle(_operationTimeout, cancellationToken);
                await _amqpUnit.SendEventsAsync(messages, ctb.Token).ConfigureAwait(false);
            }
            finally
            {
                if (Logging.IsEnabled)
                {
                    Logging.Exit(this, messages, cancellationToken, nameof(SendEventAsync));
                }
            }
        }