💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
```scala package com.gosuncn import org.apache.flink.streaming.api.scala._ object WordCountStreamingJob { def main(args: Array[String]) { val env = StreamExecutionEnvironment.getExecutionEnvironment // lines.flatMap(_.split(" ")).map((_, 1)).keyBy(0).sum(1).print() val lines: DataStream[String] = env.socketTextStream("47.52.74.183", 8888) val words: DataStream[String] = lines.flatMap(_.split(" ")) val wordAndOne: DataStream[(String, Int)] = words.map((_, 1)) val summed: DataStream[(String, Int)] = wordAndOne.keyBy(0).sum(1) summed.print() env.execute("WordCountStreamingJob") } } ```