コード例 #1
0
        public override void AddWaiter <T>(Guid parentId, FlowWaiterDefinition <T> definition, FlowLinkDefinition <T> link)
        {
            if (!_blockContainer.TryGetSourceBlock(parentId, out SourceBlockBase <T> parentBlock))
            {
                throw new Exception($"Cannot link block {definition.BlockInfo.Name} with id {definition.BlockInfo.Id} to parent block. " +
                                    "Parent block not found.");
            }

            if (!_blockContainer.TryGetBlock(definition.BlockInfo.Id, out WaiterBlock <T> waiter))
            {
                BlockHeader        header   = new BlockHeader(definition.BlockInfo, Definition.ServiceInfo);
                FlowWaiterSettings settings = (FlowWaiterSettings)definition.Settings;

                definition.Settings.Type       = _flowType;
                definition.Settings.Iterations = _iterations;

                LinkRouterBase <T>     router   = GetLinkFromProducerType <T>(settings.ProducerType);
                IBlockLinkReceiver <T> receiver = link.LinkFactory.CreateReceiver(link);

                waiter = new WaiterBlock <T>(header, receiver, router, definition);
                AssignLoggers(waiter);
                _blockContainer.AddBlock(waiter);
            }

            Link(parentBlock, waiter, link);
        }
コード例 #2
0
 internal FlowWaiterDefinition(BlockInfo blockInfo, FlowWaiterSettings settings) : base(blockInfo, settings, null, BlockType.Waiter)
 {
 }
コード例 #3
0
 internal FluentWaiterDefinitionThatWaits(BlockInfo blockInfo, FlowWaiterSettings waiterSettings)
 {
     _blockInfo      = blockInfo;
     _waiterSettings = waiterSettings;
 }