Example #1
0
        private IListBlockContext <TItem, THeader> CreateListBlockContext <TItem, THeader>(ListBlockRequest blockRequest, ProtoListBlock listBlock, int forcedBlockQueueId = 0)
        {
            var attempt       = listBlock.Attempt + 1;
            var createRequest = new BlockExecutionCreateRequest(new TaskId(blockRequest.ApplicationName, blockRequest.TaskName),
                                                                blockRequest.TaskExecutionId,
                                                                blockRequest.BlockType,
                                                                listBlock.ListBlockId,
                                                                attempt);

            var blockExecutionId = _blockRepository.AddListBlockExecution(createRequest);

            var listBlockOfT = Convert <TItem, THeader>(listBlock);
            var blockContext = new ListBlockContext <TItem, THeader>(_listBlockRepository,
                                                                     _taskExecutionRepository,
                                                                     blockRequest.ApplicationName,
                                                                     blockRequest.TaskName,
                                                                     blockRequest.TaskExecutionId,
                                                                     blockRequest.ListUpdateMode,
                                                                     blockRequest.UncommittedItemsThreshold,
                                                                     listBlockOfT,
                                                                     blockExecutionId,
                                                                     blockRequest.MaxStatusReasonLength,
                                                                     forcedBlockQueueId.ToString());

            return(blockContext);
        }
Example #2
0
        private async Task <IListBlockContext <T> > CreateListBlockContextAsync <T>(ListBlockRequest blockRequest, ProtoListBlock listBlock, int forcedBlockQueueId = 0)
        {
            var attempt       = listBlock.Attempt + 1;
            var createRequest = new BlockExecutionCreateRequest(new TaskId(blockRequest.ApplicationName, blockRequest.TaskName),
                                                                blockRequest.TaskExecutionId,
                                                                BlockType.List,
                                                                listBlock.ListBlockId,
                                                                attempt);

            var blockExecutionId = await _blockRepository.AddListBlockExecutionAsync(createRequest).ConfigureAwait(false);

            var listBlockOfT = Convert <T>(listBlock);
            var blockContext = new ListBlockContext <T>(_listBlockRepository,
                                                        _taskExecutionRepository,
                                                        blockRequest.ApplicationName,
                                                        blockRequest.TaskName,
                                                        blockRequest.TaskExecutionId,
                                                        blockRequest.ListUpdateMode,
                                                        blockRequest.UncommittedItemsThreshold,
                                                        listBlockOfT,
                                                        blockExecutionId,
                                                        blockRequest.MaxStatusReasonLength,
                                                        forcedBlockQueueId.ToString());

            return(blockContext);
        }