Giter Club home page Giter Club logo

microservices-example's Introduction

Microservices-example

Example of a microservices using Spring Cloud, Spring Boot, Docker, Mysql, MongoDB, RabbitMQ, Keycloak, Spring WebFlux, Resilience4J

About the project

  • User can create, customer, create order and get all orders by customer through API Gateway. MySQL is used for storage customers and orders. The service uses Asynchronous communication between notification service, using RabbitMQ. And WebClient is used as Synchronous communication betwen inventoery service
  • User can create product, get list of all products and check for product availability through API Gateway. MongoDB is used for storage all prodcuts.
  • You can't create order if there isn't your product in warehouse.
  • Notification service is used for getting email after create a new order.
  • User can login through Keycloak
  • All projects configurations: https://github.com/MaximRom00/Microservices-example/tree/master/config-repo

6 services whose name are shown below have been devised in this project:

  • API Gateway - API Gateway which is responsible to route the request to specific microservice. The service does user authentication via OAuth 2.0. You can access the API Gateway at http://localhost:8180.
  • Config Server - Centralized configuration service.
  • Discovery Server - Service registry that allows other services to find and communicate with each other. You can access this service at http://localhost:8761.
  • Customer Service - Responsible for managing orders and customers products.
  • Invtentory Service - Responsible for managing catalog products.
  • Notification Service - Responsible for getting and sending email notification.

Explore Rest APIs

HTTP Verb API Description Request Body Response Body
POST /api/customer Create a new customer CustemerDto Customer
POST /api/order Create a new order OrderDto
GET /api/getOrders Get all orders by customer CustomerDto List of orders
POST /api/product Add a new product to warehouse ProductRequest ProductResponse
GET /api/product Get all products from warehouse None ProductResponse
GET /api/product/inventory Check your product in warehouse String InventoryResponse
POST /api/notification/email Send email NotificationDto None

Used Dependencies

  • Core
    • Spring
      • Spring Boot
      • Spring Security
        • OAuth 2.0 Resource Server
      • Spring Web
      • Spring Data
        • Spring Data JPA
      • Spring WebFlux
      • Spring Cloud
        • Spring Cloud Gateway
        • Spring Cloud Bootstrap
        • Spring Cloud Config Server
        • Spring Cloud Config Client
      • Springdoc-openapi
    • Netflix
      • Eureka Server
      • Eureka Client
  • Database
    • Mysql
    • MongoDB
  • Message Broker
    • RabbitMQ
  • Circuit Breaker
    • Resilience4j
  • Lombok
  • Security
    • Keycloak

Run the App

Maven:

1 ) Start Keycloak and Rabbit through Docker

2 ) Implement their settings

3 ) Download your project from this link: https://github.com/MaximRom00/Microservices-example

4 ) Go to the project's home directory

5 ) Create a jar file though this command: mvn clean install

6 ) Run the project though this command: mvn spring-boot:run

Docker

1 ) Open Docker Desktop or Docker Desktop (if you use Windows 7/8).

2 ) Open terminal and start all containers

    docker-compose up

3 ) Keycloak

    1 ) Open Keycloak on the Browser through localhost:8080 (or http://192.168.99.100:8080 - if you use docker tolbox)
    2 ) Enter username and password (admin : admin)
    3 ) After you login, you need to setup a Realm and Client (https://www.keycloak.org/docs/latest/server_admin/index.html#admin-console)

4 ) RabbitMQ

    1 ) Open Rabbitmq on the Browser through http://localhost:15672 (or http://192.168.99.100:15672 - if you use docker tolbox)
    2 ) Enter username and password (user : password)

5 ) Stops containers

    docker-compose down

microservices-example's People

Contributors

maxim471 avatar maximrom00 avatar

Watchers

 avatar  avatar

Forkers

nikitavpatil74

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.