Flink(五) —— DataStream API

package flink

import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
import org.apache.flink.api.scala._

case class SensorReading(id: String, timestamp: Long, temperature: Double)

object SourceTest {

  def main(args: Array[String]): Unit = {

    val env = StreamExecutionEnvironment.getExecutionEnvironment

    // 1.从自定义的集合中读取数据
    val list = List(
      SensorReading("sensor1", 153242, 35.8),
      SensorReading("sensor2", 153222, 15.4),
      SensorReading("sensor3", 153142, 6.7),
      SensorReading("sensor4", 151242, 38.7))

    val stream1 = env.fromCollection(list)

    stream1.print("stream1").setParallelism(1)

    env.execute("source test")

  }

}

Flink(五) —— DataStream API

上一篇:通过pip 安装 TensorFlow Windows10 安装笔记


下一篇:gogs Windows环境搭建