GithubHelp home page GithubHelp logo

kafka-mongo-async-example's Introduction

Async high load kafka producer-consumer example

Prerequisites

Python 3.10.7 or greater Docker version 20.10.5+dfsg1, build 55c4c88 or greater Docker Compose version v2.3.3 or greater

Run

  1. Run the infrastructure with docker-compose

    $ docker-compose up -d

    note: sometimes the kafka fails to communicate with zookeeper. So far, the solution is to run ocker-compose down and retry the command. A suggested way to verify is to run docker ps after the command above.

  2. Create a virtual env with a tool of your choice and install the dependencies

    $ pip install -r requirements.txt
  3. Run the consumer

    $ python consumer.py
  4. Run the producer

    $ python producer.py

Note: for some reason, when running with the debugger it retrieves old messages, outside, it get only new ones, which is why in the run description you should run the consumer previous to the producer.

Tech

  • aiokafka: async lib to produce messages and read them from kafka
  • motor: async lib used to store message values in mongo

kafka-mongo-async-example's People

Contributors

rafaelcascalho avatar

Watchers

James Cloos avatar  avatar

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.