private void OnProcessEvent(object sender, ElapsedEventArgs e) { ////Parallel.For(0, ApplicationContext.GetCapacity(), (i) => ////{ //// _service.Process(); ////}); // Execute the task currentCapacity times. for (int ctr = 0; ctr < ApplicationContext.GetCapacity(); ctr++) { if (ApplicationContext.Peek() != null) { Task.Run(() => { SyncDbDetail detail = ApplicationContext.DeQueue(); _service.Process(detail); }, _source.Token).ContinueWith((i) => { ApplicationContext.Consume(); }, _source.Token); } } Console.WriteLine("OnProcessEvent"); ////throw new NotImplementedException(); }
private void LoadJobCollectionQueue() { // Get Data from Db var data = new SyncDbDetail() { CustomerCode = "1", FileName = "1.zip", Status = 1, User = "******" }; _jobCollection.Enqueue(data); }
public static void EnQueue(SyncDbDetail detail) { _jobCollection.Enqueue(detail); }