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.
Microservice | Purpose | Note |
---|---|---|
airport-pilot-service | ||
airport-flight-service | This microservice internally calls airport-pilot-service using OpenFiegn to get PILOT details. | |
airport-booking-service | This microservice internally calls airport-flight-service using OpenFiegn to get FLIGHT details. | |
airport-security-service | ||
airport-checkin-service | ||
airport-boarding-service | 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 |
- Spring Boot (Starter)
- Web
- RESTful API controller, service, repository, entity, VO, DTO, yml, pom
- @ControllerAdvice exception handling
- SLF4J with Logback logging
- Test
- JUnit
- unit testing for RestController
- Jacoco code coverage
- JUnit
- Data JPA
- Actuator monitor & manage microservices
- CORS enabled allow specific cross origin, methods
- Prometheus & Grafana monitoring & alerting systems
- Mail send an email
- Web
- Spring Cloud (Starter)
- Eureka Server & Clients service discovery server and clients
- Gateway api gateway
Zuul is deprecated.
- It also does load balancing so no need to use separate Spring Cloud Load Balancer.
Ribbon is deprecated.
- OpenFeign declarative REST client
- Its an alternative to WebClient.
RestTemplate is deprecated.
- Its an alternative to WebClient.
- Circuit Breaker
- It provides an abstraction across different circuit breaker implementations i.e. Resilience4J, Spring Retry.
Hystrix is deprecated
- Resilience4j circuit breaker implementation
- It provides an abstraction across different circuit breaker implementations i.e. Resilience4J, Spring Retry.
- Sleuth & Zipkin distributed tracing system
- Hazelcast caching
- SonarQube code quality review
- OpenAPI swagger-ui
- Postman
- Lombok minimize the boilerplate code
- ModelMapper object mapping
- Maven
- JDK 11
- Eclipse IDE
- ANSIConsole plugin colorful console logs
- MySQL RDBMS
- Docker dockerization
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
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
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.
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": "mr.billgates@yahoo.com", "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
Similarly there are a bunch of APIs (e.g. create/read/update/delete/findByXXX) in each microservice which you can explore yourself easily.
Free Software, by Siraj Chaudhary