Exemplo n.º 1
0
        /// <summary>
        /// Factory to produce a stage consisting of these vertices.
        /// </summary>
        /// <param name="placement">Placement to use for vertices in the stage</param>
        /// <param name="stream">Source data stream</param>
        /// <param name="factory">Function from index and stage to a UnaryVertex</param>
        /// <param name="inputPartitionBy">input partitioning requirement</param>
        /// <param name="outputPartitionBy">output partitioning guarantee</param>
        /// <param name="name">console-friendly name</param>
        /// <returns>stream of records from the vertices</returns>
        public static Stream <TOutput, TTime> MakeStage(Placement placement, Stream <TInput, TTime> stream, Func <int, Stage <TTime>, UnaryVertex <TInput, TOutput, TTime> > factory, Expression <Func <TInput, int> > inputPartitionBy, Expression <Func <TOutput, int> > outputPartitionBy, string name)
        {
            var stage = Foundry.NewStage(placement, stream.Context, factory, name);

            var input1 = stage.NewInput(stream, (message, vertex) => vertex.OnReceive(message), inputPartitionBy);
            var output = stage.NewOutput(vertex => vertex.Output, outputPartitionBy);

            return(output);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new stream from the output of a stage of BinaryVertex objects.
        /// </summary>
        /// <param name="stream1">first input stream</param>
        /// <param name="stream2">second input stream</param>
        /// <param name="factory">factory from index and stage to BinaryVertex</param>
        /// <param name="input1PartitionBy">first input partitioning requirement</param>
        /// <param name="input2PartitionBy">second input partitioning requirement</param>
        /// <param name="outputPartitionBy">output partitioning guarantee</param>
        /// <param name="name">friendly name</param>
        /// <returns>the output stream of the corresponding binary stage.</returns>
        public static Stream <TOutput, TTime> MakeStage(Stream <TInput1, TTime> stream1, Stream <TInput2, TTime> stream2, Func <int, Stage <TTime>, BinaryVertex <TInput1, TInput2, TOutput, TTime> > factory, Expression <Func <TInput1, int> > input1PartitionBy, Expression <Func <TInput2, int> > input2PartitionBy, Expression <Func <TOutput, int> > outputPartitionBy, string name)
        {
            var stage = Foundry.NewStage(stream1.Context, factory, name);

            var input1 = stage.NewInput(stream1, (message, vertex) => vertex.OnReceive1(message), input1PartitionBy);
            var input2 = stage.NewInput(stream2, (message, vertex) => vertex.OnReceive2(message), input2PartitionBy);

            var output = stage.NewOutput(vertex => vertex.Output, outputPartitionBy);

            return(output);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructs a new Sink stage
        /// </summary>
        /// <param name="stream">source stream</param>
        /// <param name="factory">vertex factory</param>
        /// <param name="partitionedBy">partitioning requirement</param>
        /// <param name="name">stage name</param>
        public static void MakeStage(Stream <TOutput, TTime> stream, Func <int, Stage <TTime>, SinkVertex <TOutput, TTime> > factory, Expression <Func <TOutput, int> > partitionedBy, string name)
        {
            var stage = Foundry.NewStage(stream.Context, factory, name);

            stage.NewInput(stream, (message, vertex) => vertex.OnReceive(message), partitionedBy);
        }