import org.apache.flink.streaming.api.scala.{StreamExecutionEnvironment, createTypeInformation} /** * DATE:2022/10/3 13:13 * AUTHOR:GX */ object boundedStreamProcessing { def main(args: Array[String]): Unit = { val env = StreamExecutionEnvironment.getExecutionEnvironment //读取文本文件数据 val lineDataStream = env.readTextFile("H:\\javademo\\demo\\Flink1.13.0\\src\\main\\resources\\hello.text") val boundedStream = lineDataStream.flatMap(_.split(" ")) .map(x => (x, 1)) .keyBy(0) .sum(1) boundedStream.print() env.execute("boundedStreamProcessing") } }
Flink (1.13.0) 有界流处理WordCount
猜你喜欢
转载自blog.csdn.net/GX_0824/article/details/127151471
今日推荐
周排行