internal static void OnQueueProcessed() { if (RequestQueueHandler.QueueProcessed != null) { RequestQueueHandler.QueueProcessed(null, new System.EventArgs()); } }
public virtual void TruncateQueue(string namedIndexingService, string namedIndex) { if (!SearchSettings.Config.Active) { throw new System.InvalidOperationException("Can not perform this operation when Niteco.Common.Search is not set as active in configuration"); } RequestQueueHandler.TruncateQueue(namedIndexingService, namedIndex); }
private static void Timer_Elapsed(object sender, ElapsedEventArgs e) { try { RequestQueueHandler.ProcessQueue(); } finally { RequestQueueHandler._queueFlushTimer.Enabled = true; } }
public virtual void UpdateIndex(IndexRequestItem item, string namedIndexingService) { if (!SearchSettings.Config.Active) { throw new System.InvalidOperationException("Can not perform this operation when Niteco.Common.Search is not set as active in configuration"); } if (item == null) { throw new System.ArgumentNullException("item"); } if (string.IsNullOrEmpty(item.Id)) { throw new System.ArgumentException("The Id property cannot be null"); } RequestQueueHandler.Enqueue(item, namedIndexingService); }
public static void ProcessQueue() { lock (RequestQueueHandler._syncObject) { int dequeuePageSize = SearchSettings.Config.DequeuePageSize; SearchSettings.Log.Debug(string.Format("Start dequeue unprocessed items", new object[0])); foreach (string current in SearchSettings.IndexingServices.Keys) { while (true) { try { System.Collections.ObjectModel.Collection <Identity> ids; SyndicationFeed unprocessedQueueItems = SearchFactory.GetUnprocessedQueueItems(current, dequeuePageSize, out ids); if (unprocessedQueueItems.Items.Count <SyndicationItem>() >= 1) { SearchSettings.Log.Debug(string.Format("Start processing batch for indexing service '{0}'", current)); if (RequestHandler.Instance.SendRequest(unprocessedQueueItems, current, ids)) { SearchFactory.RemoveProcessedQueueItems(ids); SearchSettings.Log.Debug(string.Format("End processing batch", new object[0])); continue; } SearchSettings.Log.Error(string.Format("Send batch for named index '{0}' failed. Items are left in queue.", current)); } } catch (System.Exception ex) { SearchSettings.Log.Error(string.Format("RequestQueue failed to retrieve unprocessed queue items. Message: {0}{1}Stacktrace: {2}", ex.Message, System.Environment.NewLine, ex.StackTrace)); } break; } } SearchSettings.Log.Debug(string.Format("End dequeue unprocessed items", new object[0])); RequestQueueHandler.OnQueueProcessed(); } }
public void Initialize(InitializationEngine context) { if (SearchSettings.Config == null) { return; } SearchSettings.Log = LogManager.GetLogger(typeof(SearchSettings).Name); SearchSettings.LoadSearchResultFilterProviders(SearchSettings.Config.SearchResultFilterElement); SearchSettings.LoadNamedIndexingServices(SearchSettings.Config.NamedIndexingServices); foreach (NamedIndexingServiceElement current in SearchSettings.IndexingServices.Values) { current.GetClientCertificate(); } if (context == null || context.HostType != HostType.Installer) { RequestQueueHandler.StartQueueFlushTimer(); } else { SearchSettings.Log.Info("Didn't start the Queue Flush timer, since HostType is 'Installer'"); } SearchSettings.OnInitializationCompleted(); SearchSettings.Log.Info("Search Module Started!"); }