예제 #1
0
        public BatchingPipe <T> Create()
        {
            BatchingPipe <T> pipe = new BatchingPipe <T>();

            PipeCreatedEvent?.Invoke(this, pipe);

            return(pipe);
        }
예제 #2
0
        public IProducer <T> Create()
        {
            BatchingPipe <T> pipe = new BatchingPipe <T>();

            Add(pipe);

            return(pipe);
        }
예제 #3
0
        public PipeMultiplier(int consumerCount)
        {
            if (consumerCount <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(consumerCount));
            }

            _pipes = new BatchingPipe <T> [consumerCount];
            for (int i = 0; i < consumerCount; i++)
            {
                _pipes[i] = new BatchingPipe <T>();
            }
        }
예제 #4
0
        public PipeMultiplexer(int consumerCount, Func <T, int> partitionSelector)
        {
            if (consumerCount <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(consumerCount));
            }
            _partitionSelector = partitionSelector ?? throw new ArgumentNullException(nameof(partitionSelector));

            _pipes = new BatchingPipe <T> [consumerCount];
            for (int i = 0; i < consumerCount; i++)
            {
                _pipes[i] = new BatchingPipe <T>();
            }
        }