Elaborate Microservice async example with FastAPI, RabbitMQ, MongoDB and Redis — part1.

Anders Wiklund
8 min readMar 29, 2023
Image created by author

Introduction

This is part1 in the series. This part talks about the problem space and a solution to handle asynchronous events between Microservices. It also covers the installation of required components.

Here’s a brief outline of the article parts:

  1. Introduction and installation of required components (this article).
  2. OrderService Architecture and Design patterns.
  3. OrderService usage of RabbitMQ.
  4. PaymentService Architecture and Design patterns.
  5. FastAPI enhancements.
  6. Putting it all together.

The problem space and a solution

The most used communication method with, and between Microservices is the HTTP RESTful protocol. This works fine when the blocking request calls are fast enough for the API to feel responsive. But if it takes some time to come up with an answer to the request, or when one request results in several responses over time?

For external API calls, Webhook callbacks is a good solution. But internally, between your own Microservices there’s a simpler solution. A Message Broker like RabbitMQ is more…

--

--