import org.apache.flink.streaming.api.scala.{StreamExecutionEnvironment, createTypeInformation} /** * DATE:2022/10/3 13:26 * AUTHOR:GX */ object unboundedStreamProcessing { def main(args: Array[String]): Unit = { val env = StreamExecutionEnvironment.getExecutionEnvironment val unbounderStream = env.socketTextStream("master",7777) val unboundedStream = unbounderStream.flatMap(_.split(" ")) .map(x => (x, 1)) .keyBy(0) .sum(1) unboundedStream.print() env.execute("unboundedStreamProcessing") } }