No Tweets using Spark Streaming and TwitterUtils


#1

So, I’ve been trying to get a stream of tweets using TwitterUtils and Spark Streaming, in scala language. This is my code so far, I think it should be enough to achieve what I’m looking for, but it seems like it isn’t getting any tweets. The output is like this:

Time: 1312300000

//Tweets should appear here

Time: 1312360000

My code in scala:

import org.apache.spark.streaming.{Seconds, StreamingContext}
import org.apache.spark.SparkContext._
import org.apache.spark.streaming.twitter._
import org.apache.spark.SparkConf
import java.io._
import scala.collection.mutable.ArrayBuffer

object TwitterPopularTags {

def main(filtroLoc: Array[String]): Unit = {


System.setProperty("twitter4j.oauth.consumerKey", CONSUMERKEY)
System.setProperty("twitter4j.oauth.consumerSecret", CONSUMERSECRET)
System.setProperty("twitter4j.oauth.accessToken", ACCESSTOKEN)
System.setProperty("twitter4j.oauth.accessTokenSecret", ACCESSTOKENSECRET)

val ssc = new StreamingContext("local[2]", "TwitterPopularTags", Seconds(60),System.getenv("SPARK_HOME"))
val stream = TwitterUtils.createStream(ssc, None)
stream.print


    ssc.start()
    ssc.awaitTermination()
}

}