Collect the records in a windows and perform some custom operations in memory

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Collect the records in a windows and perform some custom operations in memory

hafiz mujadid
Hi,

I am new to apache flink and trying to use apache flink instead of spark streaming. I want to define a window interval on my kafka stream and then after each interval, I want to get the whole batch of records within the window and perform some custom operations on this batch. In spark it is possible to collect RDD's in a batch and process them. What will be the right way to do so? I was trying this code but it did not worked

val stream:DataStream[String] = env
                        .addSource(new FlinkKafkaConsumer08[String]("test", new SimpleStringSchema(), properties))
       
        //stream.print
val result = DataStreamUtils.collect(stream.javaStream).toSeq
result.foreach(println)

Any suggestions?