How ivangfr/spring-webflux-reactive-databases works
Project Overview
• This is a full-stack reactive microservices application.
• It comprises distinct Spring Boot applications:
• product-api (managing products with MongoDB)
• customer-api (managing customers with Postgres)
• order-api (managing orders with Cassandra and orchestrating calls to customer-api and product-api)
• notification-api (managing notifications with MySQL)
• client-shell (a shell-based client that communicates with all the above APIs)
• The microservices communicate using REST (with WebClient and CompletableFuture in order-api) so that a composite view of an order includes additional data from customer-api and product-api.
Main Components and Their Relationships
a. APIs (Microservices):
• product-api: Exposes REST endpoints for product management; uses MongoDB.
• customer-api: Exposes REST endpoints for customer management; uses Postgres.
• order-api: Exposes REST endpoints for order management; uses Cassandra. Also aggregates data by making REST calls to customer-api and product-api.
• notification-api: Exposes REST endpoints for notifications; uses MySQL.
• client-shell: A command-line interface application that invokes commands to interact with the above APIs.
b. Databases:
• MongoDB for product-api.
• Postgres for customer-api.
• Cassandra for order-api.
• MySQL for notification-api.
c. Data Flow and Inter-Service Communication:
• The client-shell communicates with all the APIs to perform functions such as creating orders, fetching details, and creating notifications.
d. Infrastructure and Deployment:
• Use of Docker containerization; scripts exist to build Docker images and manage their lifecycle. While the focus may be on application architecture, you could add a deployment note about these containers.
Architectural Patterns & Technologies
• Microservices architecture with each service as an independent Spring Boot application.
• Usage of reactive programming (Spring WebFlux) on both client and server sides.
• Client-side shell (Spring Boot Shell) that provides a command interface.
• Key frameworks and tech include Spring Boot, Spring WebFlux, REST, various databases (MongoDB, Postgres, Cassandra, MySQL) and containerization with Docker.
• Integration pattern where order-api aggregates data from other services, using WebClient and CompletableFuture to asynchronously fetch additional information.