Exemple #1
0
        public async Task SendBatch(OutgoingMessageBatch batch)
        {
            if (_cancellation.IsCancellationRequested)
            {
                return;
            }

            try
            {
                if (Latched)
                {
                    await _callback.SenderIsLatched(batch);
                }
                else
                {
                    await _protocol.SendBatch(_callback, batch);

                    _logger.OutgoingBatchSucceeded(batch);
                }
            }
            catch (Exception e)
            {
                batchSendFailed(batch, e);
            }

            finally
            {
                _queued -= batch.Messages.Count;
            }
        }