Beispiel #1
0
        public void AttachNodeToOutput <TIn>(ISinkNode <TIn> node)
            where TIn : class, INodeOutput <TIn>, new()
        {
            node.SetId(Guid.NewGuid());

            ((IInputOutputAdapter <TIn>)_last).AttachConsumer(node);
            Log.Debug($"'{Name}' registered [output from] {_last.SourceNode} as [input to] target -> {node}");
        }
 public sinknodesController(ISinkNode sinknodeService)
 {
     if (sinknodeService == null)
     {
         throw new Exception("SinkNode service injection failed.");
     }
     _sinknodeService = sinknodeService;
 }
Beispiel #3
0
 public routesController(IRoutes routeService, ISinkNode sinkNodeService)
 {
     if (routeService == null)
     {
         throw new Exception("Route Service Injection failed.");
     }
     _routeService = routeService;
     if (sinkNodeService == null)
     {
         throw new Exception("Sink Node Service Injection failed.");
     }
     _sinkNodeService = sinkNodeService;
 }
Beispiel #4
0
        public bool AttachConsumer(ISinkNode <T> input)
        {
            if (input.Input != null)
            {
                throw new InvalidOperationException($"Node (Id={input.Id}, Type={input.GetType().Name}) already has an input assigned.");
            }

            if (!_queueMap.TryAdd(input, new BlockingCollection <T>(new ConcurrentQueue <T>(), 10000)))
            {
                return(false);
            }

            input
            .SetInput(GetConsumingEnumerable(input))
            .SetWaiter(Waiter);

            _sinkNodes.Add(input);

            return(true);
        }
Beispiel #5
0
 public InputOutputMap AddTargetNode(ISinkNode target)
 {
     TargetNodes.Add(target);
     return(this);
 }
Beispiel #6
0
 public IEnumerable <T> GetConsumingEnumerable(ISinkNode <T> node)
 {
     return(_queueMap[node].GetConsumingEnumerable());
 }
Beispiel #7
0
 public bool AttachConsumer(ISinkNode input)
 {
     return(AttachConsumer((ISinkNode <T>)input));
 }