Upstash Kafka Setup
Create a Kafka cluster using Upstash Console or Upstash CLI by following Getting Started. Create a topic by following the creating topic steps. Let’s name the topic “sentence”.Project Setup
If you already have a project and want to implement Upstash Kafka and Apache
Spark integration into it, you can skip this section and continue with Add
Spark and Kafka into the Project.
mvn –version
in a terminal or in a command prompt to make sure you have
Maven downloaded.
It should print out the version of the Maven you have:
cd <folder path>
Run the following command:
Add Spark and Kafka into the Project
Open the project folder by using an IDE which has maven plugin such as Intellij, Visual Studio, Eclipse etc. Add following Spark dependencies into the dependencies tag inpom.xml
file.
Using Apache Spark as Producer
Import the following packages first:UPSTASH-KAFKA-*
placeholders with your cluster information: