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(GeneralQueryResult message)
 {
     if (message.Dtos.Any())
     {
         IStorage <IndexProgress> storage = _profile.Get <IndexProgress>(typeof(IndexProgress).Name);
         storage.Clear();
         storage.Add(new IndexProgress
         {
             LastGeneralId = message.Dtos[0].ID.GetValueOrDefault(),
         });
         Send(new CommentQuery
         {
             Hql =
                 string.Format(
                     "select c from Comment c join c.General g left join g.ParentProject p where g.EntityType IN ({0}) and (p is null or p.DeleteDate is null) order by c desc skip 0 take 1",
                     _entityTypeProvider.QueryableEntityTypesIdSqlString),
             IgnoreMessageSizeOverrunFailure = true,
             Params = new object[] { }
         });
     }
     else
     {
         _documentIndexProvider.ShutdownDocumentIndexes(_pluginContext.AccountName, new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: true));
         _log.Info("Finished rebuilding indexes");
         MarkAsComplete();
     }
 }
        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
            });
        }
Example #4
0
        public void Stop()
        {
            _log.Info("Save and free Hoot storages memory at stopping Search Plugin");
            var accountCollection = ObjectFactory.GetInstance <IAccountCollection>();

            if (accountCollection != null && accountCollection.Any())
            {
                foreach (var account in accountCollection.Where(x => x.Profiles.Any() && !x.Profiles.First().Initialized))
                {
                    _documentIndexProvider.ShutdownDocumentIndexes(account.Name, new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: false));
                }
            }
            _log.Info("Finished to save and free Hoot storages memory at stopping Search Plugin");
        }
Example #5
0
 public void Handle(AccountRemovedMessage message)
 {
     _documentIndexProvider.ShutdownDocumentIndexes(message.AccountName, new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: true));
     _log.Info(string.Format("Account {0} removed with all indexes", message.AccountName));
 }
 public void Handle(AccountRemovedMessage message)
 {
     _documentIndexProvider.ShutdownDocumentIndexes(new PluginContextSnapshot(message.AccountName, new ProfileName(string.Empty), _context.PluginName), new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: true), _log);
     _log.Info(string.Format("Account {0} removed with all indexes", message.AccountName));
 }