Flink(1.13.0) 有界流处理

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")
  }
}

猜你喜欢

转载自blog.csdn.net/GX_0824/article/details/127151549