Class WordCount.Tokenizer

  • All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.functions.Function, org.apache.flink.datastream.api.function.OneInputStreamProcessFunction<String,​org.apache.flink.api.java.tuple.Tuple2<String,​Integer>>, org.apache.flink.datastream.api.function.ProcessFunction
    Enclosing class:
    WordCount

    public static final class WordCount.Tokenizer
    extends Object
    implements org.apache.flink.datastream.api.function.OneInputStreamProcessFunction<String,​org.apache.flink.api.java.tuple.Tuple2<String,​Integer>>
    Implements the string tokenizer that splits sentences into words as a user-defined ProcessFunction. The process function takes a line (String) and splits it into multiple pairs in the form of "(word,1)" (Tuple2<String, Integer>).
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Tokenizer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void processRecord​(String record, org.apache.flink.datastream.api.common.Collector<org.apache.flink.api.java.tuple.Tuple2<String,​Integer>> output, org.apache.flink.datastream.api.context.PartitionedContext<org.apache.flink.api.java.tuple.Tuple2<String,​Integer>> ctx)  
      • Methods inherited from interface org.apache.flink.datastream.api.function.OneInputStreamProcessFunction

        endInput, onProcessingTimer, onWatermark, open
      • Methods inherited from interface org.apache.flink.datastream.api.function.ProcessFunction

        close, declareWatermarks, usesStates
    • Constructor Detail

      • Tokenizer

        public Tokenizer()
    • Method Detail

      • processRecord

        public void processRecord​(String record,
                                  org.apache.flink.datastream.api.common.Collector<org.apache.flink.api.java.tuple.Tuple2<String,​Integer>> output,
                                  org.apache.flink.datastream.api.context.PartitionedContext<org.apache.flink.api.java.tuple.Tuple2<String,​Integer>> ctx)
                           throws Exception
        Specified by:
        processRecord in interface org.apache.flink.datastream.api.function.OneInputStreamProcessFunction<String,​org.apache.flink.api.java.tuple.Tuple2<String,​Integer>>
        Throws:
        Exception