title: Reading from Cassandra using Spark Streaming
body: <p>I have a problem when i use spark streaming to read from Cassandra.</p>
  
  <p><a href="https://github.com/datastax/spark-cassandra-connector/blob/master/doc/8_streaming.md#reading-from-cassandra-from-the-streamingcontext" rel="noreferrer">https://github.com/datastax/spark-cassandra-connector/blob/master/doc/8_streaming.md#reading-from-cassandra-from-the-streamingcontext</a></p>
  
  <p>As the link above, i use</p>
  
  <pre><code>val rdd = ssc.cassandraTable("streaming_test", "key_value").select("key", "value").where("fu = ?", 3)
  </code></pre>
  
  <p>to select the data from cassandra, but it seems that the spark streaming has just one query once but i want it continues to query using an interval 10 senconds.</p>
  
  <p>My code is as follow, wish for your response.</p>
  
  <p>Thanks!</p>
  
  <pre><code>import org.apache.spark._
  import org.apache.spark.streaming._
  import com.datastax.spark.connector.streaming._
  import org.apache.spark.rdd._
  import scala.collection.mutable.Queue
  
  
  object SimpleApp {
  def main(args: Array[String]){
      val conf = new SparkConf().setAppName("scala_streaming_test").set("spark.cassandra.connection.host", "127.0.0.1")
  
      val ssc = new StreamingContext(conf, Seconds(10))
  
      val rdd = ssc.cassandraTable("mykeyspace", "users").select("fname", "lname").where("lname = ?", "yu")
  
      //rdd.collect().foreach(println)
  
      val rddQueue = new Queue[RDD[com.datastax.spark.connector.CassandraRow]]()
  
  
      val dstream = ssc.queueStream(rddQueue)
  
      dstream.print()
  
      ssc.start()
      rdd.collect().foreach(println)
      rddQueue += rdd
      ssc.awaitTermination()
  }  
  </code></pre>
  
  <p>}</p>