Giter Club home page Giter Club logo

comprehensive-example-on-microservices-using-spring-boot-with-spring-cloud's Introduction

A comprehensive example on microservices using spring-boot with spring-cloud

It is a project for airport service.

In this project we have created six microservices for airport officials and airport passengers. These microservices provides services from passenger's ticket booking to passenger's boarding.

It has two more microservices one for eureka server and one for api gateway.

Watch the video


Microservice Purpose Note
airport-pilot-service
  • It is a microservice for airport officials
  • It is having APIs for PILOT such as createPilot, getPilotById, getAllPilots, updatePilot, deletePilot, findPilotsByDesignation & flushCache
  • airport-flight-service
  • It is a microservice for airport officials
  • It is having APIs for FLIGHT such as createFlight, getFlightById, updateFlight, deleteFlight & searchFlightBySourceDestinationAndDate
  • This microservice internally calls airport-pilot-service using OpenFiegn to get PILOT details.
    airport-booking-service
  • It is a microservice for airport flight passengers & airport officials
  • It is having APIs for BOOKING such as createBooking, getBookingById & findBookingByPNRNumber
  • This microservice internally calls airport-flight-service using OpenFiegn to get FLIGHT details.
    airport-security-service
  • It is a microservice for airport officials
  • It is having APIs for airport SECURITY check such as createSecurity, getSecurityById & findSecurityByBookingId
  • airport-checkin-service
  • It is a microservice for airport officials
  • It is having APIs for airport CHECKIN service such as createCheckin, getCheckinById & findCheckinByBookingId
  • airport-boarding-service
  • It is a microservice for airport officials
  • It is having APIs for BOARDING findBoardingByBookingId
  • This microservice internally calls airport-booking-service, airport-checkin-service, airport-security-service using OpenFiegn to get BOOKING, CHECKIN, SECURITY CHECK details.
    eureka-server It is a microservice for service discovery and registry
    api-gateway It is a microservice work as a gateway (single entry point) for all microservices

    Microservice Architecture

    microservices-architecture

    Technology Stack

    HowTo

    Step 1. Database Setup (you can use MySQL Workbench)

    • create schema CREATE DATABASE airportdb
    • create tables by running dump file airportdb.sql

    Step 2 (optional). Download and Run the Zipkin Server to trace Sleuth logs on GUI.

    Step 3. Configure lombok for your eclipse IDE (i.e. run lombok.jar)

    Step 4. Clone the project

    git clone https://github.com/SirajChaudhary/comprehensive-example-on-microservices-using-spring-boot-with-spring-cloud.git

    Step 5. Import the project into your eclipse IDE

    Step 6. Update following properties

    • update your database credentials in the .properties file wherever it is used in all microservices.
    • update YOUR_GMAIL_USERNAME/YOUR_GMAIL_PASSWORD in the .properties file of airport-booking-service.

    Step 7. Build all microservices mvn clean install
    - we build microservices in the following sequence and before that we set Java Build Path of each microservice to JDK11

    • eureka-server
    • api-gateway
    • airport-pilot-service
    • airport-flight-service
    • airport-booking-service
    • airport-security-service
    • airport-checkin-service
    • airport-boarding-service

    Step 8. Run all microservices in the following sequence.

    • eureka-server
    • api-gateway
    • all microservices one by one in any sequence

    Step 9. Run APIs in the following sequence for the first time using Postman or OpenAPI
    - Import the attached postman collection into postman client.

    • airport-pilot-service
    • airport-flight-service
    • airport-booking-service
    • airport-security-service
    • airport-checkin-service
    • airport-boarding-service

    Snapshots

    Eureka Server

    http://localhost:8761/ http://localhost:8761/

    OpenAPI

    swagger-ui will be used just for testing purpose. It won't route via API Gateway. We run like an independent swagger-ui of each microservice.

    Postman

    API calls will route via API Gateway (2021) only!

    URL: localhost:2021/airport-pilot-service/api/v1/pilots
    Method: POST
    RequestBody: { "name": "Ashutosh Sharma", "designation": "Sr. Captain", "experience": "22 Year" }

    URL: localhost:2021/airport-flight-service/api/v1/flights
    Method: POST
    RequestBody: { "vendor": "AirIndia", "source": "Delhi", "destination": "London", "departureDate": "08/08/2021", "departureTime": "10:15pm", "status": "On Time", "pilotId": 1 }

    URL: localhost:2021/airport-booking-service/api/v1/bookings
    Method: POST
    RequestBody: { "fullname": "Bill Gates", "mobile": "9100800123", "email": "[email protected]", "address": "stree1, adambakham", "flightNumber": 1 }

    URL: localhost:2021/airport-security-service/api/v1/securities
    Method: POST
    RequestBody: { "identityProof": "passport", "covidReport": "-ve", "ctScan": "done", "status": "done", "bookingId": "1" }

    URL: localhost:2021/airport-checkin-service/api/v1/checkin
    Method: POST
    RequestBody: { "checkInBags": "5", "cabinBags": "2", "bookingId": "1" }

    URL: localhost:2021/airport-boarding-service/api/v1/boardings/find-by-booking-id/1
    Method: GET

    output

    Similarly there are a bunch of APIs (e.g. create/read/update/delete/findByXXX) in each microservice which you can explore yourself easily.

    License

    Free Software, by Siraj Chaudhary

    comprehensive-example-on-microservices-using-spring-boot-with-spring-cloud's People

    Contributors

    sirajongithub avatar

    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.