Guided Exercise - Microservices - Design Patterns - API Gateway #157
Replies: 18 comments 3 replies
|
Hi @akash-coded |
|
Hi Akash, Sharing my code in zip file for Microservices - Design Patterns - API Gateway with Eureka service discovery. |
|
Hi Akash, API Gateway with Eureka service discovery Thanks |
|
@akash-coded : https://github.com/arghyagiri/microservice-e2/tree/main/library-management-system-modularized |
|
Hi @akash-coded Here are solutions, without discovery as you told us to complete - https://github.com/jay4tech/order-service/tree/msa_157 Swagger UI - All the requests are getting routed through the API gateway URL i.e. http://localhost:8080/<service_predicates>/ |
|
Hi @akash-coded I have implemented API discovery and API gateway on the library-microservices https://github.com/Rajashree-Ravi/author-service https://github.com/Rajashree-Ravi/library-api-discovery |
|
Hey Akash, here's my work towards the ApiGateway/Eureka task assigned during class. Name: Anubhav Ghosh |
|
Hi Akash, Here are the urls and codebase: https://github.com/samik2023/order-service Gateway: Services: Regards |
|
Hello @akash-coded , good morning, Please check this https://github.com/ssagarwala/API-Gateway-practice I also put in 2 screen shots. Please provide feedback. |
|
Hi @akash-coded ,
http://localhost:8090/order [Order API accessed through gateway port] three projects attached. Code worked to access API of customer and order through the port configured in gateway service Name: Arul |
|
Hi @akash-coded , Sharing my code in zip file for Microservices - Design Patterns - API Gateway with Eureka service discovery. |
|
Hi @akash-coded. Please find my git hub link for my project. https://github.com/obulix/MicSrv-ApiGateway I have added postman link as well in the repository. |
|
hi @akash-coded , name : Pradnya Kinge |
|
Hi Akash, Please find the attached file for API Gateway implementation. Thanks, |
|
Hi Akash, Please find the attached file for API Gateway implementation with Eureka service discovery. Name: Abhrajit |
|
Hi @akash-coded Please find attached api-gateway implementation for library management system microservice. The postman collection is also included where Get All Authors, Books and Borrowings were tested for verifying api gateway functionality. mid-assessment_api_gateway.zip Thanks |
|
Hi Akash, Thanks |
|
Hi Akash, Thanks |
Uh oh!
There was an error while loading. Please reload this page.
API Gateway Pattern in Spring Microservices
The API Gateway pattern is another crucial pattern in microservices architecture, serving as a single-entry point for various microservices running in your ecosystem. It is responsible for request routing, load balancing, security, and other cross-cutting concerns.
Prerequisites
Architecture Overview
CustomerService: Manages customer dataOrderService: Manages ordersApiGateway: A single entry point that routes requests to various servicesStep 1: Create Microservices
Create three Spring Boot projects (
CustomerService,OrderService,ApiGateway).Step 2: Add Dependencies
CustomerServiceandOrderService, add:ApiGateway, add:Step 3: Create Business Logic
CustomerService:
OrderService:
Step 4: Implement API Gateway
In the
ApiGatewayapplication, you'll need to define routes for your services. Modify yourapplication.ymlorapplication.propertiesto add the following:Step 5: Service Discovery (Optional)
If you're using Eureka or other service discovery, the routes could be more dynamic. Add the following to your
ApiGateway'sapplication.properties:eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/Code Repository Structure
Internal Details
Best Practices, Dos, and Don'ts
Optimizations
The API Gateway pattern is highly useful for operations, security, and optimizing requests and should be part of your microservices architecture for more resilient systems.
Let's take a deeper dive into the microservices, their responsibilities, and differences.
Deeper Dive into Microservices
CustomerService
Responsibilities
Configuration & Setup
Code Snippet & Hints
Model:
Repository:
Controller:
Differences & Unique Features
OrderService
Responsibilities
Configuration & Setup
Code Snippet & Hints
Model:
Repository:
Controller:
Differences & Unique Features
ApiGateway
Responsibilities
Configuration & Setup
application.ymlfor routing.Code Snippet & Hints
Differences & Unique Features
Best Practices for Deep Dive
By examining each microservice in detail, you can see how they each serve unique responsibilities. However, they are also similar in structure since they're all Spring Boot applications. This setup fosters consistency and maintainability, which is crucial in a microservices architecture.
All reactions