Example #1
0
 public void Handle(IndexExistingEntitiesLocalMessage message)
 {
     _sagaServices.TryCompleteInprogressSaga <IndexExistingEntitiesSagaData>(Data.Id);
     _documentIndexProvider.ShutdownDocumentIndexes(_pluginContext, new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: true), _logger);
     Data.OuterSagaId = message.OuterSagaId;
     _generalsIndexing.Start();
 }
        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
            });
        }