Skip to content

πŸ— Course: Microservices with Spring Boot, Spring Cloud, and Netflix Eureka. Presented by Genilson Medeiros Martins | GM2 - Treinamentos e Consultoria.

License

Notifications You must be signed in to change notification settings

souzafcharles/Microservice-Architecture-Java-Spring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

30 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GitHub language count GitHub top language GitHub GitHub last commit

Course: Microservices with Spring Boot, Spring Cloud, and Netflix Eureka


▢️ Presented by Genilson Medeiros Martins | GM2 - Training and Consulting.


System Overview:

This system implements a microservices architecture for managing bank accounts and transactions, as depicted in the provided diagram. It leverages the capabilities of the Spring Boot framework, incorporating key technologies such as Spring Cloud and Netflix Eureka to deliver a scalable and resilient solution.

The system employs a layered architecture, with the API Gateway providing an abstraction layer between clients and microservices. Service discovery and load balancing are crucial for ensuring scalability and high availability. The use of separate databases (MySQL and MongoDB) reflects the polyglot persistence approach, where each microservice can choose the most appropriate database technology.


Project Microservice Architecture:

Microservice Architecture

The architecture comprises the following key components:

  • account-service:
    • Manages customer account data stored in a MySQL database;
    • Provides RESTful APIs for account creation, retrieval, and validation;
    • Operates with redundancy across ports 8000 and 8001.
  • transaction-service:
    • Handles bank transactions, storing transaction data in MongoDB;
    • Offers APIs for deposits, withdrawals, and inter-account transfers;
    • Utilises OpenFeign to communicate with the Account Service for account validation;
    • Operates with redundancy across ports 8080 and 8081.
  • discovery-service:
    • Uses Netflix Eureka to enable service registration and discovery;
    • Facilitates dynamic service location and load balancing;
    • Operates on port 8761.
  • api-gateway:
    • Acts as a single entry point for client requests;
    • Routes requests to the appropriate microservices;
    • Operates on port 8765.
  • load-balancing:
    • Distributes incoming traffic across multiple instances of the Account and Transaction services to enhance performance and availability.
  • Client Apps:
    • Represents client devices (e.g., desktops, mobile phones) that interact with the system via the API Gateway.

Project Stack:

Technology Version Description
πŸ“ IntelliJ IDEA 2024.3 Integrated Development Environment (IDE)
β˜• Java 21 Backend programming language
🌱 Spring Boot 3.4.3 Framework for creating Spring applications
🐦 Maven 3.9.9 Build automation and dependency management tool
🐬 MySQL 9.2.0 Open-source relational database management system
πŸƒ MongoDB 8.0 NoSQL document-oriented database
☁️ Spring Cloud 2024.0.0 Framework for building cloud-native applications
🧭 Netflix Eureka 3.0.0 Service registry and discovery server
πŸ”— OpenFeign 4.2.0 Declarative REST client
πŸ”„ Resilience4j 2.3.0 Fault tolerance library for microservices
πŸ‘©β€πŸš€ Postman 11.19 API testing and development tool

Dependencies

Dependency Category Description
🌐 Spring Web Web Build web, including RESTful, applications using Spring MVC
πŸ’Ύ Spring Data JPA SQL Simplifies database interactions using JPA with Spring Data and Hibernate
🐘 MySQL Driver SQL Provides connectivity between Java applications and MySQL databases
πŸƒ Spring Data MongoDB NoSQL Provides integration with MongoDB, allowing data access in a reactive or blocking way
🌢️ Lombok Developer Tools A Java annotation library that minimises boilerplate code
πŸ”— OpenFeign Cloud Simplifies HTTP API client creation with declarative REST clients
🧭 Netflix Eureka Server Cloud Provides a service registry for microservices architecture using Eureka Server
βš–οΈ Load Balancer Cloud Provides client-side load balancing
πŸšͺ Gateway Cloud Provides a library for building API Gateways on top of Spring WebFlux
πŸ—ΊοΈ ModelMapper Utility A library that simplifies object mapping by automatically mapping properties between objects
πŸ”„ Resilience4j Fault Tolerance Provides circuit breakers, rate limiters, retries, and bulkheads for microservices
β–Ά Actuator Monitoring Provides production-ready features for monitoring and managing applications
πŸ” AOP Aspect-Oriented Enables aspect-oriented programming with Spring AOP and AspectJ
πŸ—οΈ dotenv-java Configuration Loads environment variables from a .env file, aiding secure configuration management

Contents:

Module 1

  • 1.0 Introduction;
  • 1.1 Tools;
  • 1.2 Monolithic Architecture;
  • 1.3 Microservices Architecture.

Module 2

  • 2.1 Monolithic Architecture;
  • 2.2 Microservice Architecture.

Module 3

(Microservice 1 - Bank Account)

  • 3.1 IDE Configuration;
  • 3.2 Project Creation;
  • 3.3 Structuring and Entity;
  • 3.4 Customer Repository;
  • 3.5 Customer Service;
  • 3.6 Customer Controller;
  • 3.7 Standardising Responses;
  • 3.8 Automatic Account Number Generator;
  • 3.9 Retrieving All User Accounts;
  • 3.10 Account Validation;
  • 3.11 Custom Exception;
  • 3.12 Configuring Redundancy for the Microservice.

Module 4

(Microservice 2 - Bank Transactions)

  • 4.1 Microservice Creation and Structuring;
  • 4.2 MongoDB Configuration and Entities;
  • 4.3 Repositories;
  • 4.4 Transaction Controller;
  • 4.5 Transaction Service;
  • 4.6 Using OpenFeign to Validate Customer Account;
  • 4.7 Custom Exception for Account Validation;
  • 4.8 Calculating Account Balance;
  • 4.9 Implementing Account Statement;
  • 4.10 Transfer Controller;
  • 4.11 Inter-Account Transfer;
  • 4.12 Transfer Statement Business Logic;
  • 4.13 Statement for Destination Account;
  • 4.14 Retrieving All Account Transfers.

Module 5

  • 5.1 Introduction to Discovery Service;
  • 5.2 Implementing Discovery Service and Registering Microservices;
  • 5.3 Load Balancing.

Module 6

  • 6.1 Introduction to API Gateway;
  • 6.2 API Gateway Project Creation and Configuration;
  • 6.3 Testing the API Gateway Service;
  • 6.4 Configuring Routes.

Module 7

  • 7.1 Retry with Resilience4j;
  • 7.2 Retry Attempts;
  • 7.3 Fallback Method - Custom Exception;
  • 7.4 Wait Duration.

βœ… CERTIFICATE OF ACHIEVEMENT

About

πŸ— Course: Microservices with Spring Boot, Spring Cloud, and Netflix Eureka. Presented by Genilson Medeiros Martins | GM2 - Treinamentos e Consultoria.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages