
talystcode.streaming-reddit_2.11.0.0.2.source-code.RedditDemo.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of streaming-reddit_2.11 Show documentation
Show all versions of streaming-reddit_2.11 Show documentation
A library for reading public web postings from Reddit using Spark Streaming.
The newest version!
import com.github.catalystcode.fortis.spark.streaming.reddit.RedditAuth
import org.apache.log4j.{BasicConfigurator, Level, Logger}
object RedditDemo {
def main(args: Array[String]) {
val mode = args.headOption.getOrElse("")
// configure interaction with reddit api
val auth = RedditAuth(
applicationId = System.getenv("REDDIT_APPLICATION_ID"),
secret = System.getenv("REDDIT_APPLICATION_SECRET")
)
// configure logging
BasicConfigurator.configure()
Logger.getRootLogger.setLevel(Level.ERROR)
Logger.getLogger("lib-reddit").setLevel(Level.DEBUG)
if (mode.contains("standalone")) new RedditDemoStandalone(auth).run()
if (mode.contains("spark")) new RedditDemoSpark(auth).run()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy