// Separated for testing here. public async Task ProcessReceivedMessages(DateTime now, Uri uri, Envelope[] envelopes) { if (_settings.Cancellation.IsCancellationRequested) { throw new OperationCanceledException(); } Envelope.MarkReceived(envelopes, uri, DateTime.UtcNow, _settings.UniqueNodeId, out var scheduled, out var incoming); await _persistence.StoreIncoming(envelopes); foreach (var message in incoming) { await Enqueue(message); } _logger.IncomingBatchReceived(envelopes); }