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; }
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; }
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); }
public InputOutputMap AddTargetNode(ISinkNode target) { TargetNodes.Add(target); return(this); }
public IEnumerable <T> GetConsumingEnumerable(ISinkNode <T> node) { return(_queueMap[node].GetConsumingEnumerable()); }
public bool AttachConsumer(ISinkNode input) { return(AttachConsumer((ISinkNode <T>)input)); }