Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reinaldoholtz/async-user-email-microservice-communication-broker
Communication between 2 microservices using RABBITMQ broker
https://github.com/reinaldoholtz/async-user-email-microservice-communication-broker
Last synced: about 1 month ago
JSON representation
Communication between 2 microservices using RABBITMQ broker
- Host: GitHub
- URL: https://github.com/reinaldoholtz/async-user-email-microservice-communication-broker
- Owner: reinaldoholtz
- Created: 2024-09-20T14:52:23.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-20T15:59:30.000Z (4 months ago)
- Last Synced: 2024-11-06T19:51:17.822Z (3 months ago)
- Language: Java
- Size: 135 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Asynchronous Communication Between Microservices Using RabbitMQ
![Asynchronous Communication Flow](./Project-Flow.jpg)
## Project Description
This project demonstrates the asynchronous communication flow between two microservices using RabbitMQ as a message broker. The scenario involves registering a new user and sending a confirmation email.## Project Flow
1. A client sends a POST request to register a new user in the system.
2. Once the "User Microservice" receives the new user:
- 2.1 It saves the user in the database (the "User Microservice" is responsible for managing users in the system).
- 2.2 Then, it produces a message to the Broker to handle asynchronous communication.
3. The Broker (RabbitMQ) receives the message.
4. The "Email Microservice," which is connected to this Broker:
- 4.1 Consumes the message.
- 4.2 Sends a "Registration Successful" confirmation email.
- 4.3 Finally, it saves the email record in the database.This flow enables asynchronous communication, ensuring decoupling between the microservices for improved scalability and fault tolerance.
## Technologies Used
1. **Java (version 17)**: Core programming language used to build the microservices.
2. **Maven**: Dependency management tool used to handle project libraries and build the project.
3. **Lombok**: Automates code generation for getters, setters, constructors, and other boilerplate code.
4. **Spring Ecosystem**:
- **Spring Boot**: To bootstrap and run the business microservices.
- **Spring Web**: To create RESTful endpoints.
- **Spring Data JPA**: To interact with the database and handle transactions.
- **Spring Validation**: To validate API inputs.
- **Spring AMQP**: To work with messaging protocols for asynchronous processing.
- **Spring Mail**: To send confirmation emails to users.
5. **PostgreSQL**: The relational database used to store user and email information.
6. **RabbitMQ**: Message broker used for asynchronous communication (hosted on Cloud AMQP).
7. **Cloud AMQP**: RabbitMQ hosted in the cloud to manage message queues.
8. **SMTP (Google Mail)**: SMTP server used to send confirmation emails.