Code Monkey home page Code Monkey logo

pubsub's Introduction

PubSub Architecture using FastAPI and Redis

Introduction to PubSub or Event-driven architecture using Redis and FastAPI

Workflow

  1. Publisher tries to connect to external API leveraging the power of asynchronous and parallel processing and fetches the response.

  2. The response is then published on the REDIS CHANNEL.

  3. This response/message is then further fetched by the subscriber by subscribing the REDIS CHANNEL.

Configuring the environment

Follow the below steps to configure the environment.

  1. Install the poetry.
    pip install poetry
  2. Initialize poetry shell.
    poetry shell
  3. Install the dependencies.
    poetry install

Configuring the project

  1. To configure the url, host and port numbers, copy the '.env.example' file.
  2. Rename it to '.env'
  3. Change the values with your required host and port numbers.

Run the project

To run the api, use the following command.

`sh run.sh`

API Documentation

  1. For the API documentation, copy the three urls into three separate tabs in the browser.
  2. Append "/docs" to the end of each urls.
  3. Click on "Try it Out" and then hit "Execute."

Screenshots :

  1. Beer Details API

img.png

  1. Publisher API

img_1.png

  1. Subsriber API

img_2.png

Once you hit the execute button, you will be able to see the messages getting printed on the terminal.

NOTE :

Since this is just an introduction to the implementation of Redis as a message broker. Feel free to use this as a reference to expand your knowledge on the Event-Driven Architecture.

Happy Learning !!!

pubsub's People

Contributors

anurag14041996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pubsub's Issues

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.