上回利用transform方法实现对于数据流的图并行计算过程,今天继续改进完善已有的计算机制,加入updateStateByKey和checkpoint机制,保障图并行计算在故障中仍能保证零误差。
import kafka.serializer.StringDecoder
import org.apache.spark.streaming._
import org.apache.spark.streaming.kafka._
import org.apache.spark._
import org.apache.spark.rdd.RDD
import org.apache.spark.graphx._
object DirectKafkaGraphxUpdate {
def updateFunction(newValues: Seq[Set[Long]], runningCount: Option[Set[Long]]): Option[Set[Long]] = {
def show(x: Option[Set[Long]]) = x match {
<