【发布时间】:2016-09-28 12:52:48
【问题描述】:
我正在研究 Spark Streaming 编程指南。我有一个基本的疑问,比如它何时会执行/计算Dstream 输出操作。
例如(我从一个例子中得到它):
val ssc = new StreamingContext(conf, Seconds(1))
val lines = ssc.socketTextStream("localhost", 7777)
lines.foreachRDD { rdd =>
rdd.foreachPartition { partitionOfRecords =>
val connection = createNewConnection()
partitionOfRecords.foreach(record => connection.send(record))
connection.close()
}
}
// Start the computation
ssc.start()
// Wait for the computation to terminate
ssc.awaitTermination()
它会在每个batch-iterval 1 秒处执行操作吗?或者等到终止。
【问题讨论】:
标签: scala apache-spark spark-streaming