Exemple #1
0
        public virtual async Task ProcessSuccessHandle(StatefulService statefulService, TimeSpan timeout, CancellationToken cancellationToken, string processQueueTypeTrace)
        {
            WorkItemStore workItemStore = await WorkItemStore.CreateOrGetWorkItemStore(statefulService);

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

                await workItemInProcessStore.DeleteValueAsync(this.WorkItemGuid, timeout, cancellationToken, transaction);

                await transaction.CommitAsync();

                BackupRestoreTrace.TraceSource.WriteInfo(processQueueTypeTrace, "Process Success Handle WorkItemStore and WorkItemInProcessStore Delete From Store WorkItem : {0} is success.", this);
            }
        }
        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());
            }
        }