flink source fromCollection source


import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment}
import org.apache.flink.api.scala._

object FlinkDemo03_CommonSource_fromEle {
    
    case class Student(name: String, age: Int)
    
    def main(args: Array[String]): Unit = {
        //1 创建环境
        val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
        //2 读取数据
        val ds: DataStream[Student] = env.fromCollection(List(Student("jack", 20), Student("rose", 18)))
        //3 计算
        ds.print()
        
        //4 执行
        env.execute()
    }
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM