Exemple #1
0
        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);
        }
        public override async Task ProcessFailureHandle(StatefulService statefulService, TimeSpan timeout, CancellationToken cancellationToken, string processQueueTypeTrace)
        {
            WorkItemInProcessStore workItemInProcessStore = await
                                                            WorkItemInProcessStore.CreateOrGetWorkItemInProcessStore(statefulService);

            WorkItemQueue1Min workItemQueue1Min = await WorkItemQueue1Min.CreateOrGetWorkItemQueue(statefulService);

            WorkItemProcessInfo workItemProcessInfo = await workItemInProcessStore.GetValueAsync(this.WorkItemGuid);

            using (ITransaction transaction = statefulService.StateManager.CreateTransaction())
            {
                await workItemInProcessStore.DeleteValueAsync(this.WorkItemGuid, timeout, cancellationToken, transaction);

                await workItemQueue1Min.AddWorkItem(workItemProcessInfo, timeout, cancellationToken, transaction);

                await transaction.CommitAsync();

                BackupRestoreTrace.TraceSource.WriteInfo(processQueueTypeTrace, "Process Failure Handle WorkItemInProcessStore Delete WorkItem {0} And Enqueue in {1}  ", this, workItemQueue1Min.GetType());
            }
        }
Exemple #3
0
        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");
        }