The Aggregator Service acts as the central hub for the Spring WebFlux project. It connects the frontend with the Stock Service and the Customer Service, aggregating data from these sources to provide comprehensive information about stocks and customer portfolios. It also manages the buying and selling of stocks based on the latest prices.
Reactive Programming is a programming model focused on data streams and the propagation of changes. It is particularly suited for applications that need to process a large number of events asynchronously and handle high throughput.
Spring Boot simplifies the development of Spring-based applications by providing default configurations and tools to create production-ready applications with minimal setup.
Spring WebFlux is a fully non-blocking, reactive web framework that supports asynchronous processing and backpressure. It is ideal for building applications that need to scale and handle a large number of concurrent requests.
Scalability: Efficiently manages a large number of concurrent users.
Reactive Streams Support: Ensures that the system remains responsive under load by handling backpressure.
Improved Resource Utilization: Uses fewer threads to handle more requests, reducing resource consumption.
The Aggregator Service communicates with:
Stock Service: Queries the Stock Service for real-time stock price updates.
Customer Service: Retrieves customer portfolio information, including account balance and owned stocks.
Stock Transactions: When buying or selling stocks, the Aggregator Service first queries the Stock Service for the current price, then updates the Customer Service with the new portfolio details.
+----------+ +-------------------+ +---------------+
| Frontend | <------> | Aggregator Service| <------> | Stock Service |
+----------+ +-------------------+ +---------------+
|
|
v
+-------------------+
| Customer Service |
+-------------------+
You can find a video in the demo folder.