Skip to content

Instantly share code, notes, and snippets.

@thomasdziedzic
Last active August 26, 2016 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasdziedzic/8a6cc222ba837012c266d48e61fa06bd to your computer and use it in GitHub Desktop.
Save thomasdziedzic/8a6cc222ba837012c266d48e61fa06bd to your computer and use it in GitHub Desktop.
import org.apache.spark.streaming._
import org.apache.spark.streaming.kafka010._
val kafkaParams = Map("metadata.broker.list" -> "localhost:9092")
val topics = Set("test")
val streamingContext = new StreamingContext(sc, Seconds(1))
val kafkaStream = KafkaUtils.createDirectStream(streamingContext, kafkaParams, topics)
kafkaStream.print()
streamingContext.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment