https://github.com/souzafcharles/invest-portfolio-microservices
๐ Demonstration of Microservices with RabbitMQ (Includes CloudAMQP) managing investment portfolios in the financial sector
https://github.com/souzafcharles/invest-portfolio-microservices
cloudamqp jpa jpa-hibernate microservices postgresql rabbitmq rabbitmq-consumer rabbitmq-producer spring spring-boot spring-mvc spring-web sql
Last synced: 2 months ago
JSON representation
๐ Demonstration of Microservices with RabbitMQ (Includes CloudAMQP) managing investment portfolios in the financial sector
- Host: GitHub
- URL: https://github.com/souzafcharles/invest-portfolio-microservices
- Owner: souzafcharles
- License: mit
- Created: 2025-04-02T19:11:29.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-04-03T02:53:12.000Z (3 months ago)
- Last Synced: 2025-04-03T12:17:06.690Z (3 months ago)
- Topics: cloudamqp, jpa, jpa-hibernate, microservices, postgresql, rabbitmq, rabbitmq-consumer, rabbitmq-producer, spring, spring-boot, spring-mvc, spring-web, sql
- Language: Java
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README



# Demonstration of Microservices with RabbitMQ (Includes CloudAMQP) managing investment portfolios in the financial sector
## System Overview:
This report presents the development of a distributed system designed to manage investment portfolios in the financial industry. The system is comprised of two independent microservicesโPortfolio and Processโdeveloped using theJava Spring
framework. It facilitates the creation, organisation, and processing of portfolios, ensuring scalability and modularity through event-driven communication powered byRabbitMQ
. By leveraging key technologies, such asSpring Boot
,Spring Data JPA
, andMongoDB
, the architecture ensures robustness, efficiency, and flexibility for financial operations.
The Portfolio microservice serves as the backbone of the application, handling the creation and persistence of portfolio entities in aPostgreSQL
database. Each portfolio, represented by the Portfolio class, consists of a title and an associated list of assets. These assets, defined by the Asset class, contain details such as name and quantity, capturing the composition of the investment portfolio with precision. This microservice exposes RESTful endpoints for portfolio management and incorporates message brokering capabilities. Upon portfolio creation, it serialises relevant data into JSON format and publishes it to the messaging queue configured inRabbitMQ
, utilising theJackson2JsonMessageConverter
.
The Process microservice complements the Portfolio microservice by consuming messages asynchronously from the RabbitMQ queue. It listens for incoming portfolio data, deserialises it intoPortfolioRequestDTO
, and processes the information as required. The architecture ensures loose coupling between the microservices, enhancing scalability and maintainability. The Process microservice is equipped with aMongoDB
database connection, supporting further operations or storage needs.
This distributed system harnesses the advantages of theJava Spring
framework and event-driven design to offer an efficient solution for managing investment portfolios. With its modular architecture, the system is built to ensure high reliability, extensibility, and seamless integration with financial systems. The inclusion of PostgreSQL for persistent portfolio storage and MongoDB for dynamic processing demonstrates the strategic choice of technologies for scalability and performance. The RabbitMQ messaging broker serves as the linchpin for communication between microservices, supporting asynchronous processing and enhancing overall system reliability.***
## Project Microservice Architecture:
The architecture comprises the following key components:
* **Client Apps:**
* Represents client devices (e.g., desktops, mobile phones) that interact with the system via the Portfolio API.* [Portfolio Microservice:](https://github.com/souzafcharles/Invest-Portfolio-Microservices/tree/main/portfolio)
* Provides RESTful APIs for creating, retrieving, and managing investment portfolios;
* Stores portfolio and asset data in a PostgreSQL database;
* Publishes portfolio creation events to RabbitMQ for asynchronous processing;
* Operates on port 8081.* **RabbitMQ (Broker):**
* Serves as the messaging broker for communication between microservices;
* Includes an exchange (`exchange.process`) to route messages to the appropriate queue;
* Manages a queue (`portfolio.process.queue`) to hold messages for processing.* [Process Microservice:](https://github.com/souzafcharles/Invest-Portfolio-Microservices/tree/main/process)
* Consumes messages from the RabbitMQ queue asynchronously;
* Deserialises messages into `PortfolioRequestDTO` for processing;
* Operates on port 8082;
* Connects to MongoDB for dynamic storage and further operations.* **Persistence and Messaging:**
* Utilises PostgreSQL for storing persistent portfolio data in the Portfolio microservice;
* Utilises MongoDB for dynamic storage in the Process microservice;
* RabbitMQ enables decoupled, event-driven communication between the Portfolio and Process microservices.* **Technology Stack:**
* Employs theJava Spring
framework, incorporatingSpring Boot
,Spring Data JPA
, and RabbitMQ integration;
* UtilisesJackson2JsonMessageConverter
to serialise and deserialise JSON messages seamlessly.## Project Stack:
| Technology | Version | Description |
|-------------------|------------|----------------------------------------------------------------------------------|
| ๐ IntelliJ IDEA | `2024.3` | Integrated Development Environment (IDE) |
| โ Java | `21` | Backend programming language |
| ๐ฑ Spring Boot | `3.4.4` | Framework for creating Spring applications |
| ๐ฆ Maven | `3.9.9` | Build automation and dependency management tool |
| ๐ PostgreSQL | `15.4` | Open-source relational database management system used in Portfolio Microservice |
| ๐ MongoDB | `8.0` | NoSQL document-oriented database used in Process Microservice |
| ๐ RabbitMQ | `3.12.1` | Open-source message broker used for asynchronous communication |
| โ๏ธ CloudAMQP | `4.0` | Hosted RabbitMQ service (via CloudAMQP) used for asynchronous message brokering |
| ๐ฉโ๐ Postman | `11.19` | API testing and development tool |***
## Dependencies:
| Dependency | Category | Description |
|--------------------------------------|------------------|---------------------------------------------------------------------------------------------|
| ๐ Spring Web | Web | Builds web applications, including RESTful APIs using Spring MVC |
| ๐พ Spring Data JPA | SQL | Simplifies database interactions using JPA with Spring Data and Hibernate |
| ๐ PostgreSQL Driver | SQL | Provides connectivity between Java applications and PostgreSQL databases |
| ๐ Spring Data MongoDB | NoSQL | Integrates with MongoDB, enabling reactive as well as blocking data access |
| ๐ Spring AMQP | Messaging | Provides integration with RabbitMQ for message-driven architecture; utilised with CloudAMQP |
| ๐ ๏ธ Spring Boot Devtools | Developer Tools | Offers development-time tools for application restart and debugging |