예제 #1
0
        private async Task deleteIncoming(Envelope[] envelopes)
        {
            try
            {
                await _persistor.DeleteIncomingEnvelopes(envelopes);

                IncomingDeleted.Set();
            }
            catch (Exception e)
            {
                _logger.LogException(e);
                foreach (var envelope in envelopes)
                {
                    DeleteIncoming(envelope);
                }
            }
        }
예제 #2
0
        protected override async Task afterRestarting(ISender sender)
        {
            var expired = Queued.Where(x => x.IsExpired()).ToArray();

            if (expired.Any())
            {
                await _persistor.DeleteIncomingEnvelopes(expired);
            }

            var toRetry = Queued.Where(x => !x.IsExpired()).ToArray();

            Queued = new List <Envelope>();

            foreach (var envelope in toRetry)
            {
                await _sender.Enqueue(envelope);
            }
        }