The Spark Streaming integration for Kafka 0.10 is similar in design to the 0.8 Direct Stream approach. It provides simple parallelism, 1:1 correspondence between Kafka partitions and Spark partitions, and access to offsets and metadata. However, because the newer integration uses the new Kafka consumer API instead of the simple API, there are notable differences in usage. This version of the integration is marked as experimental, so the API is potentially subject to change.
In thisblog, I am going to implement the basic example on Spark Structured Streaming & Kafka Integration.
Here, I am using
- Apache Spark 2.2.0
- Apache Kafka 0.11.0.1
- Scala 2.11.8
Create the built.sbt
Let’s create a sbt project and add following dependencies in build.sbt.
libraryDependencies ++= Seq("org.apache.spark" % "spark-sql_2.11" % "2.2.0", "org.apache.spark" % "spark-sql-kafka-0-10_2.11" % "2.2.0", "org.apache.kafka" % "kafka-clients" % "0.11.0.1")
View original post 317 more words