GithubHelp home page GithubHelp logo

tarequzzaman / kafka-streaming Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 952 KB

A simple implementation of Kafka message streaming using Python

License: Apache License 2.0

Python 100.00%
docker-compose-template kafka kafka-consumer kafka-consumer-group kafka-producer kafka-python kafka-streams python-kafka

kafka-streaming's Introduction

Kafka-Streaming

This project aims to demonstrate a simple implementation of Kafka message streaming using Python. The project includes a producer, which sends messages to Kafka, and a consumer, which consumes these messages. The messages in this project are generated using Python's fake user information data. With this project, you can learn the basics of Kafka messaging and how to use Python to generate and consume messages.

Prerequisite:

  • Docker
  • docker-compose
  • Python3.11

Installation:

  1. We need to up the Kafka server along with zookeeper & Kafdrop Admin Frontend type the below command

    docker-compose up 
    

    in case of run demon mode:

    docker-compose up -d 
    
  2. After executing the step (1) we will visit:

    http://127.0.0.1:9002/
    
  3. After exectuting (1) & (2) now we are ready to create topic using this admin dashboard. The steps along with screenshot given below:

    alt text

    As in our code we will added user-registration as Kafka topic, we need to create new topic from the topic section of the dashbaord

    alt text

    Now we will put the topic name and partition and replication factor. As we have use only one kafka server as standlone. In our case we need to keep replication factor 1

    alt text

    We have done with created our topic. Now we are allowing to send and receive message through this topic.

    alt text

  4. In this step we will do all python related task

    • Create a virtual-environment & activate it

      python3.11 -m venv env 
      
      source env/bin/activate
      
    • Install the requirements by using this command

      pip install -r requirements.txt
      
    • Receive meeage via consumer.

      python consumer.py
      
    • Send message through producer. After environment activation we need to type

      python producer.py
      

Reference:

  1. https://github.com/obsidiandynamics/kafdrop
  2. https://kafka-python.readthedocs.io/en/master/

kafka-streaming's People

Contributors

tarequzzaman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

saklain-tonmoy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.