Skip to content

A Guide to setup Kafka with Python in less than 5 minutes

Notifications You must be signed in to change notification settings

rawheel/Kafka-Python-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kafka with Python Setup in Less than 5 Minutes

This guide demonstrates a quick setup for working with Kafka and Python using Faust and Docker Compose. You can have Kafka up and running in just a few minutes following these steps.

Step 1: Setting Up Kafka with Docker Compose

  1. Clone the kafka-stack-docker-compose repository:

    git clone https://github.com/conduktor/kafka-stack-docker-compose
    
  2. Navigate to the repository directory:

    cd kafka-stack-docker-compose
  3. Start Kafka and ZooKeeper containers:

    docker compose -f zk-single-kafka-single.yml up
    

Step 2: Running the Python Kafka Setup

  1. Clone this project:

    git clone https://github.com/rawheel/Kafka-Python-Example.git
    
  2. Navigate to the project directory:

    cd Kafka-Python-Example
  3. Install project dependencies:

    pip install -r requirements.txt
  4. Start a Faust worker:

    faust -A worker worker -l info
  5. To produce a Kafka message using the Faust command-line tool, run:

    faust -A worker send hello_world 'Hello Folks, Raheel Here!'
    
  6. To produce kafka messages using python code

    python producer.py

Releases

No releases published

Packages

 
 
 

Languages