Kafka Producer & Consumer example in Python

You will learn how to create Kafka producer and Consumer in python.

  1. Install kafka-python we will use KafkaProducer and KafkaConsumer
pip3 install kafka-python
  1. Run 01-start-zookeeper.sh start zookeeper server
  2. Run 02-start-kafka.sh start kafka server
  3. Run producer.py
  4. Run consumer.py

This is it. We have created our first Kafka consumer in python. We can see this consumer has read messages from the topic and printed it on a console.

Git push script

git add . && git commit -m 'new app' && git push