public static async Task <StreamProcessorChain <TIn, TIn> > Where <TOldIn, TIn>(
            this StreamProcessorChain <TOldIn, TIn> previousNode, Func <TIn, bool> filterFunc)
        {
            var processorAggregate = await previousNode.Factory.CreateWhere(filterFunc, await previousNode.Aggregate.GetStreamIdentities());

            var processorChain = new StreamProcessorChain <TIn, TIn>(processorAggregate, previousNode);

            return(processorChain);
        }
        public static async Task <StreamProcessorChain <TIn, TIn, TFactory> > Where <TOldIn, TIn, TFactory>(
            this StreamProcessorChain <TOldIn, TIn, TFactory> previousNode, Expression <Func <TIn, bool> > filterFunc, int scatterFactor = 1) where TFactory : IStreamProcessorAggregateFactory
        {
            var aggregateConfiguration = new StreamProcessorAggregateConfiguration(await previousNode.Aggregate.GetOutputStreamsWithSourceLocation(), scatterFactor);
            var processorAggregate     = await previousNode.Factory.CreateWhere(filterFunc, aggregateConfiguration);

            var processorChain = new StreamProcessorChain <TIn, TIn, TFactory>(processorAggregate, previousNode);

            return(processorChain);
        }
        public static async Task <StreamProcessorChain <TIn, TOut> > Select <TOldIn, TIn, TOut>(
            this StreamProcessorChain <TOldIn, TIn> previousNode, Func <TIn, TOut> selectionFunc)
        {
            var processorAggregate =
                await previousNode.Factory.CreateSelect <TIn, TOut>(selectionFunc, await previousNode.Aggregate.GetStreamIdentities());

            var processorChain = new StreamProcessorChain <TIn, TOut>(processorAggregate, previousNode);

            return(processorChain);
        }
        public static async Task <StreamProcessorChain <TIn, TOut, TFactory> > SelectMany <TOldIn, TIn, TIntermediate, TOut, TFactory>(
            this StreamProcessorChain <TOldIn, TIn, TFactory> previousNode, Expression <Func <TIn, IEnumerable <TIntermediate> > > collectionSelectorFunc, Expression <Func <TIn, TIntermediate, TOut> > resultSelectorFunc, int scatterFactor = 1) where TFactory : IStreamProcessorAggregateFactory
        {
            var aggregateConfiguration = new StreamProcessorAggregateConfiguration(await previousNode.Aggregate.GetOutputStreamsWithSourceLocation(), scatterFactor);
            var processorAggregate     =
                await previousNode.Factory.CreateSelectMany(collectionSelectorFunc, resultSelectorFunc, aggregateConfiguration);

            var processorChain = new StreamProcessorChain <TIn, TOut, TFactory>(processorAggregate, previousNode);

            return(processorChain);
        }