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

            PipeCreatedEvent?.Invoke(this, pipe);

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

            Add(pipe);

            return(pipe);
        }
Beispiel #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>();
            }
        }
Beispiel #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>();
            }
        }