コード例 #1
0
        protected void CompleteSaga <T>(Guid sagaId) where T : IContainSagaData
        {
            var saga = _sagaPersister.Get <T>(sagaId);

            Assert.NotNull(saga);
            _sagaPersister.Complete(saga);
        }
コード例 #2
0
        protected async Task CompleteSaga <T>(Guid sagaId) where T : class, IContainSagaData
        {
            var saga = await LoadSaga <T>(sagaId).ConfigureAwait(false);

            Assert.NotNull(saga);
            await _sagaPersister.Complete(saga, null, null).ConfigureAwait(false);
        }
        protected override void OnStartInitialization()
        {
            try
            {
                foreach (var tpSagaEntity in ObjectFactory.GetInstance <IStorageRepository>().Get <ISagaEntity>())
                {
                    if (!(tpSagaEntity is SearcherPluginProfileInitializationSagaData ||
                          tpSagaEntity is SearcherPluginProfileUpdatedInitializationData))
                    {
                        continue;
                    }

                    if (tpSagaEntity.Id != Data.Id)
                    {
                        _sagaPersister.Complete(tpSagaEntity);
                    }
                }
            }
            catch (Exception e)
            {
                _log.ErrorFormat("Failed to complete Running Saga When start to rebuild indexed, error: ", e.Message);
            }

            Send(new GeneralQuery
            {
                Hql =
                    string.Format(
                        "select g from General g left join g.ParentProject p where g.EntityType IN ({0}) and (p is null or p.DeleteDate is null) order by g desc skip 0 take 1",
                        _entityTypeProvider.QueryableEntityTypesIdSqlString),
                IgnoreMessageSizeOverrunFailure = true,
                Params = new object[] { }
            });
            _log.Info("Started rebuilding indexes");
        }
コード例 #4
0
        public void Handle(IndexExistingEntitiesLocalMessage message)
        {
            try
            {
                foreach (var tpSagaEntity in ObjectFactory.GetInstance <IStorageRepository>().Get <ISagaEntity>())
                {
                    if (!(tpSagaEntity is IndexExistingEntitiesSagaData))
                    {
                        continue;
                    }

                    if (tpSagaEntity.Id != Data.Id)
                    {
                        _sagaPersister.Complete(tpSagaEntity);
                    }
                }
            }
            catch (Exception e)
            {
                _logger.ErrorFormat("Failed to complete Running Saga When start to rebuild indexed, error: ", e.Message);
            }
            _documentIndexProvider.ShutdownDocumentIndexes(_pluginContext.AccountName,
                                                           new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: true));

            Data.OuterSagaId            = message.OuterSagaId;
            Data.GeneralsRetrievedCount = 0;
            Data.CommentsRetrievedCount = 0;

            Send(new GeneralQuery {
                Hql = string.Format(GeneralsHql, Data.SkipGenerals, PageSize), IgnoreMessageSizeOverrunFailure = true, Params = _param
            });
        }
コード例 #5
0
 public bool TryCompleteInprogressSaga <TSaga>(Guid sagaId)
 {
     try
     {
         foreach (ISagaEntity candidate in _storageRepository.Get <ISagaEntity>())
         {
             if (!(candidate is TSaga))
             {
                 continue;
             }
             if (candidate.Id != sagaId)
             {
                 _sagaPersister.Complete(candidate);
                 return(true);
             }
         }
     }
     catch (Exception e)
     {
         _logger.ErrorFormat("Failed to complete Running Saga When start to rebuild indexed, error: ", e.Message);
     }
     return(false);
 }