internal static async Task <BaseWorkItemQueue> GetNextWorkItemQueue(WorkItemQueueRunType workItemQueueRunType, StatefulService statefulService) { BackupRestoreTrace.TraceSource.WriteInfo("BackupRestore.GetNextWorkItemQueue", "workItemQueueRunType {0} ", workItemQueueRunType); BaseWorkItemQueue baseWorkItemQueue = null; switch (workItemQueueRunType) { case WorkItemQueueRunType.WorkItemQueue: baseWorkItemQueue = await WorkItemQueue1Min.CreateOrGetWorkItemQueue(statefulService); break; case WorkItemQueueRunType.WorkItemQueue1MinDelay: baseWorkItemQueue = await WorkItemQueue2Min.CreateOrGetWorkItemQueue(statefulService); break; case WorkItemQueueRunType.WorkItemQueue2MinDelay: baseWorkItemQueue = await WorkItemQueue4Min.CreateOrGetWorkItemQueue(statefulService); break; case WorkItemQueueRunType.WorkItemQueue4MinDelay: baseWorkItemQueue = await WorkItemQueue8Min.CreateOrGetWorkItemQueue(statefulService); break; case WorkItemQueueRunType.WorkItemQueue8MinDelay: baseWorkItemQueue = await WorkItemQueue8Min.CreateOrGetWorkItemQueue(statefulService); break; } BackupRestoreTrace.TraceSource.WriteInfo("BackupRestore.GetNextWorkItemQueue", "Next WorkItemQueue {0} ", baseWorkItemQueue.GetType()); return(baseWorkItemQueue); }
internal static async Task <WorkItemQueue8Min> CreateOrGetWorkItemQueue(StatefulService statefulService) { if (workItemQueue == null) { IReliableQueue <WorkItemProcessInfo> workItemReliableQueue = await statefulService.StateManager.GetOrAddAsync <IReliableQueue <WorkItemProcessInfo> >(Constants.WorkItemQueue8Min); workItemQueue = new WorkItemQueue8Min(workItemReliableQueue, 8, WorkItemQueueRunType.WorkItemQueue8MinDelay, statefulService); } return(workItemQueue); }
internal static async Task StartAndScheduleWorkItemHandler(StatefulService statefulService) { BackupRestoreTrace.TraceSource.WriteInfo(TraceType, "Initializing Work Item Queue and Handlers"); workItemQueue = await WorkItemQueue.CreateOrGetWorkItemQueue(statefulService); workItemQueue1Min = await WorkItemQueue1Min.CreateOrGetWorkItemQueue(statefulService); workItemQueue2Min = await WorkItemQueue2Min.CreateOrGetWorkItemQueue(statefulService); workItemQueue4Min = await WorkItemQueue4Min.CreateOrGetWorkItemQueue(statefulService); workItemQueue8Min = await WorkItemQueue8Min.CreateOrGetWorkItemQueue(statefulService); BackupRestoreTrace.TraceSource.WriteInfo(TraceType, "Initialized Work Item Queue and Handlers"); BackupRestoreTrace.TraceSource.WriteInfo(TraceType, "Initializing RecoverInProcessWorkItemWrapper"); await RecoverInProcessWorkItemWrapper(statefulService); BackupRestoreTrace.TraceSource.WriteInfo(TraceType, "RecoverInProcessWorkItemWrapper Completed"); }
internal void DisposeWorkItemQueue() { this.DisposeWorkItemDeQueuer(); workItemQueue = null; }