第1关:QueueStream
import java.text.SimpleDateFormat
import java.util.Date
import org.apache.spark.{HashPartitioner, SparkConf}
import org.apache.spark.rdd.RDD
import org.apache.spark.streaming.{Seconds, StreamingContext}
import scala.collection.mutable
object QueueStream {
def main(args: Array[String]) {
val rddQueue = new mutable.SynchronizedQueue[RDD[String]]()
val conf = new SparkConf().setMaster("local[2]").setAppName("queueStream")
/********** Begin **********/
//1.初始化StreamingContext,设置时间间隔为1s
val ssc = new StreamingContext(conf, Seconds(1))
//2.对接队列流
val inputStream = ssc.queueStream(rddQueue)
/**
*
* 数据格式如下ÿ