Beispiel #1
0
        private async Task <dynamic> AcknowledgeOperation(dynamic parameters)
        {
            var groupId = parameters.groupId;

            if (ArchiveOperationManager.IsArchiveInProgressFor(groupId))
            {
                ArchiveOperationManager.DismissArchiveOperation(groupId, ArchiveType.FailureGroup);
                return(HttpStatusCode.OK);
            }

            using (var session = Store.OpenAsyncSession())
            {
                var retryHistory = await session.LoadAsync <RetryHistory>(RetryHistory.MakeId()).ConfigureAwait(false);

                if (retryHistory != null)
                {
                    if (retryHistory.Acknowledge(groupId, RetryType.FailureGroup))
                    {
                        await session.StoreAsync(retryHistory).ConfigureAwait(false);

                        await session.SaveChangesAsync().ConfigureAwait(false);

                        return(HttpStatusCode.OK);
                    }
                }
            }

            return(HttpStatusCode.NotFound);
        }
Beispiel #2
0
        public async Task <GroupOperation[]> GetGroups(IAsyncDocumentSession session, string classifier, string classifierFilter)
        {
            var dbGroups = await GetDBGroups(session, classifier, classifierFilter).ConfigureAwait(false);

            var retryHistory = await session.LoadAsync <RetryHistory>(RetryHistory.MakeId()).ConfigureAwait(false) ?? RetryHistory.CreateNew();

            var unacknowledgedRetries = retryHistory.GetUnacknowledgedByClassifier(classifier);

            var openRetryAcknowledgements   = MapAcksToOpenGroups(dbGroups, unacknowledgedRetries);
            var closedRetryAcknowledgements = unacknowledgedRetries.Except(openRetryAcknowledgements).ToArray();

            var closedGroups = MapClosedGroups(classifier, closedRetryAcknowledgements);

            closedGroups = closedGroups.Union(MapClosedGroups(classifier, archivingManager.GetArchivalOperations().Where(archiveOp => archiveOp.NeedsAcknowledgement())));

            var openGroups = MapOpenGroups(dbGroups, retryHistory, openRetryAcknowledgements).ToList();

            openGroups = MapOpenGroups(openGroups, archivingManager.GetArchivalOperations()).ToList();
            openGroups = openGroups.Where(group => !closedGroups.Any(closedGroup => closedGroup.Id == group.Id)).ToList();

            MakeSureForwardingBatchIsIncludedAsOpen(classifier, await GetCurrentForwardingBatch(session).ConfigureAwait(false), openGroups);

            var groups = openGroups.Union(closedGroups);

            return(groups.OrderByDescending(g => g.Last).ToArray());
        }
        private dynamic AcknowledgeOperation(dynamic parameters)
        {
            var groupId = parameters.groupId;

            if (ArchiveOperationManager.IsArchiveInProgressFor(groupId))
            {
                ArchiveOperationManager.DismissArchiveOperation(groupId, ArchiveType.FailureGroup);
                return(HttpStatusCode.OK);
            }

            using (var session = Store.OpenSession())
            {
                var retryHistory = session.Load <RetryHistory>(RetryHistory.MakeId());
                if (retryHistory != null)
                {
                    if (retryHistory.Acknowledge(groupId, RetryType.FailureGroup))
                    {
                        session.Store(retryHistory);
                        session.SaveChanges();

                        return(HttpStatusCode.OK);
                    }
                }
            }

            return(HttpStatusCode.NotFound);
        }
Beispiel #4
0
        async Task <dynamic> GetRetryHistory()
        {
            using (var session = Store.OpenAsyncSession())
            {
                var retryHistory = await session.LoadAsync <RetryHistory>(RetryHistory.MakeId()).ConfigureAwait(false) ?? RetryHistory.CreateNew();

                return(Negotiate
                       .WithDeterministicEtag(retryHistory.GetHistoryOperationsUniqueIdentifier())
                       .WithModel(retryHistory));
            }
        }
        dynamic GetRetryHistory()
        {
            using (var session = Store.OpenSession())
            {
                var retryHistory = session.Load <RetryHistory>(RetryHistory.MakeId()) ?? RetryHistory.CreateNew();

                return(Negotiate
                       .WithDeterministicEtag(retryHistory.GetHistoryOperationsUniqueIdentifier())
                       .WithModel(retryHistory));
            }
        }
Beispiel #6
0
        private dynamic AcknowledgeOperation(dynamic parameters)
        {
            var groupId = parameters.groupId;

            using (var session = Store.OpenSession())
            {
                var retryHistory = session.Load <RetryHistory>(RetryHistory.MakeId());

                if (retryHistory != null)
                {
                    retryHistory.Acknowledge(groupId, RetryType.FailureGroup);
                }

                session.Store(retryHistory);
                session.SaveChanges();
            }

            return(HttpStatusCode.OK);
        }