Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.19 KB

README.md

File metadata and controls

41 lines (31 loc) · 1.19 KB

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