The Research Nest
Published in

The Research Nest

Creating a Real-time Data Stream Using Apache Kafka in Python

A beginner-level tutorial on setting up Kafka with python in windows 10

Use Apache Kafka with Python 🐍 in Windows 10 to stream any real-time data 📊

What is Apache Kafka 🤔?

Let us do one better :P Why Kafka 🤔?

🖥️ Phase 1: Setting up your development environment

$ bin/kafka-topics.sh --create --topic data-stream --bootstrap-server localhost:9092

Python setup for Kafka

$ sudo apt install python3-pip
$ sudo apt install python3-venv
$ mkdir kafka-stream
$ cd kafka-stream/
$ python3 -m venv .kafka
$ source .kafka/bin/activate
$ pip install kafka-python
$ code .

🖥️ Phase 2: Streaming Data

python producer.py
Producer Terminal
Consumer Terminal (It is actual real-time data)
$ rm -rf /tmp/kafka-logs /tmp/zookeeper

--

--

Empowering humanity with exclusive insights.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
XQ

Tech 👨‍💻 | Life 🌱 | Careers 👔 | Poetry 🖊️