예제 #1
0
        public async Task Complete()
        {
            var toSkip = new HashSet <DocumentBase>(DocumentBaseEqualityComparer.Instance);

            while (_identityMap
                   .Except(toSkip, DocumentBaseEqualityComparer.Instance)
                   .Any(a => a.Outbox.Any()))
            {
                var document = _identityMap
                               .Except(toSkip, DocumentBaseEqualityComparer.Instance)
                               .FirstOrDefault(a => a.Outbox.Any());

                if (document == null)
                {
                    continue;
                }

                var ex = await _dispatcher.Dispatch(document);

                if (ex != null)
                {
                    toSkip.Add(document);

                    await _offlineDispatcher.DispatchOffline(document);
                }
            }
        }
예제 #2
0
        public async Task Complete()
        {
            var toSkip = new HashSet <DocumentBase>(DocumentBaseEqualityComparer.Instance);

            while (TryGetDocumentWithOutboxMessages(toSkip, out var document))
            {
                var ex = await _dispatcher.Dispatch(document);

                if (ex != null)
                {
                    toSkip.Add(document);

                    await _offlineDispatcher.DispatchOffline(document);
                }
            }
        }