第75课:双十一背景下的大数据spark streaming本质思考和状态管理
1,如果有什么功能Spark Streaming没有实现的话,请使用transform
2,如果是历史状态累计更新,请使用mapWithState
3, countByValueAndWindow 4,foreachRDD(func)
dstream.foreachRDD { rdd => rdd.foreachPartition { partitionOfRecords => // ConnectionPool is a static, lazily initialized pool of connections val connection = ConnectionPool.getConnection() partitionOfRecords.foreach(record => connection.send(record)) ConnectionPool.returnConnection(connection) // return to the pool for future reuse } }