Skip to content

AryanC19/Flight_Booking_Backend

Repository files navigation

Microservices Project

This project is a microservices-based application built using Spring Boot, Spring Cloud, and Maven. It consists of the following components:

Components

  1. Eureka Server: Service registry for microservices.
  2. Gateway Microservice: API Gateway for routing requests to the appropriate microservices.
  3. Customer Microservice: Manages customer-related operations.
  4. Flight Microservice: Manages flight-related operations.
  5. Other Microservices: Includes Booking and Notification services.

Architecture

  • Eureka Server: Acts as the service registry where all microservices register themselves.
  • Gateway Microservice: Routes requests to the appropriate microservices using service discovery via Eureka.
  • Microservices: Each microservice (Customer, Flight, etc.) performs specific business logic and communicates with other services via REST APIs.

Service Connections

  • Gateway connects to all microservices via Eureka using service names.
  • Microservices register themselves with Eureka for service discovery.
  • Database: Each microservice (e.g., Customer, Flight) connects to its own database.

Prerequisites

  • Java 17
  • Maven
  • MySQL (or any configured database)
  • IDE (e.g., IntelliJ IDEA)

How to Run the Project

1. Start the Eureka Server

  • Navigate to the eureka module.
  • Run the EurekaApplication class.
  • Verify that the Eureka dashboard is accessible at http://localhost:8761.

2. Start the Gateway Microservice

  • Navigate to the gatewayMS module.
  • Run the GatewayMsApplication class.
  • The Gateway will be accessible at http://localhost:8080.

3. Start the Microservices

  • Customer Microservice:
    • Navigate to the customer module.
    • Run the CustomerApplication class.
  • Flight Microservice:
    • Navigate to the flight module.
    • Run the FlightApplication class.
  • Repeat the above steps for other microservices (e.g., Booking, Notification).

4. Verify the Setup

  • Open the Eureka dashboard (http://localhost:8761) and ensure all services are registered.
  • Use the Gateway (http://localhost:8080) to access the microservices:
    • http://localhost:8080/customer/**
    • http://localhost:8080/flight/**
    • Other routes as defined in the Gateway.

Sequence to Start Services

  1. Eureka Server (Service Registry)
  2. Gateway Microservice (API Gateway)
  3. Each Microservice (Customer, Flight, etc.)

Example API Endpoints

  • Customer Microservice:
    • GET /customer/customer/{id}: Fetch customer by ID.
  • Flight Microservice:
    • GET /flight/flight/{id}: Fetch flight by ID.

Notes

  • Ensure the database is running and configured correctly for each microservice.
  • Use application.properties or application.yml to configure database connections and Eureka settings.
  • Use Postman or any REST client to test the APIs.

Troubleshooting

  • If a service fails to register with Eureka, check the Eureka server URL in the application.properties of the microservice.
  • Ensure all required dependencies are included in the pom.xml files.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages