public void Initialize(ConfigurationOptions configurationOptions = null) { TaskManager = new CustomTaskManager() { Instance = this }; if (configurationOptions == null) { configurationOptions = new ConfigurationOptions(); } Config = configurationOptions; Log.Config = Config; DiscoveredMaxDateTicks = DateTime.MinValue.Ticks; DiscoveredMinDateTicks = DateTime.MaxValue.Ticks; FileObjects = new FileObjectCollection(); FileMgr = new FileManager(this); Kusto = new KustoConnection(this); LogAnalytics = new LogAnalyticsConnection(this); StartTime = DateTime.Now; TimedOut = false; TotalErrors = 0; TotalFilesConverted = 0; TotalFilesDownloaded = 0; TotalFilesEnumerated = 0; TotalFilesFormatted = 0; TotalFilesMatched = 0; TotalFilesSkipped = 0; TotalRecords = 0; }
// This thread procedure performs the task. private static void ThreadProc(Object stateInfo) { KustoConnection kustoConnection = stateInfo as KustoConnection; int i = 0; for (i = 0; i <= 1000; i++) { Tuple <string, string> results = kustoConnection.GetNextIngestionQueue(); Assert.IsNotNull(results.Item1); Assert.IsNotNull(results.Item2); } // No state object was passed to QueueUserWorkItem, so stateInfo is null. Console.WriteLine($"Hello from the thread pool. count{i}"); }
public void GetNextIngestionQueueTest() { Collector collector = new Collector(); ConfigurationOptions configurationOptions = new ConfigurationOptions(); configurationOptions.KustoCluster = "https://ingest-sfcluster.kusto.windows.net/sfdatabase"; configurationOptions.KustoTable = "sfcluster_test"; KustoEndpoint kustoEndpoint = new KustoEndpoint(configurationOptions); kustoEndpoint.IngestionResources = new IngestionResourcesSnapshot() { FailureNotificationsQueue = "https://fake-failure.queue/fake-fail", IngestionQueues = new List <string>() { "https://fake-ingestion.queue/fake-ingest1", "https://fake-ingestion.queue/fake-ingest2", }, SuccessNotificationsQueue = "https://fake-success.queue/fake-success", TempStorageContainers = new List <string>() { "https://fake-temp.queue/fake-temp1", "https://fake-temp.queue/fake-temp2", } }; KustoConnection kustoConnection = new KustoConnection(collector.Instance); kustoConnection.Endpoint = kustoEndpoint; kustoConnection.PopulateQueueEnumerators(); WaitCallback waitCallback = new WaitCallback(ThreadProc); bool result = ThreadPool.SetMinThreads(100, 100); for (int i = 0; i <= 1000; i++) { ThreadPool.QueueUserWorkItem(waitCallback, kustoConnection); } }