Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sshehrozali/daffodil
Distributed systems example in Spring framework using Load Balancer, API Gateway, Service Discovery and Distributed tracing.
https://github.com/sshehrozali/daffodil
distributed-computing distributed-log docker eureka http load-balancing microservices service-disovery spring spring-boot zipkin-sleuth
Last synced: 20 days ago
JSON representation
Distributed systems example in Spring framework using Load Balancer, API Gateway, Service Discovery and Distributed tracing.
- Host: GitHub
- URL: https://github.com/sshehrozali/daffodil
- Owner: sshehrozali
- Created: 2022-09-12T07:40:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-28T10:43:22.000Z (over 2 years ago)
- Last Synced: 2024-12-08T16:08:25.904Z (20 days ago)
- Topics: distributed-computing, distributed-log, docker, eureka, http, load-balancing, microservices, service-disovery, spring, spring-boot, zipkin-sleuth
- Language: Java
- Homepage:
- Size: 838 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### High-level Overview
![](misc/distributed-system-design.png)
### Microservices
* **Customer:** The goal of this microservice is to handle all Customer registration requests.
* **Fraud:** The goal of this microservice is to handle and perform all fraud checks i.e. if a customer is fraudulent or not.
* **Notification:** The goal of this microservice is to send an async notification to user's smartphone or any other device when the user has registered successfully via third-party providers like Firebase or Twilio.### API Gateway
`api-gateway` microservice uses `spring-cloud-starter-gateway` dependency to mark this service as API Gateway microservice. `APIGatewayApplication` class is annotated with `@EnableDiscoveryClient` to tell Spring that it will use Eureka Service Discovery to get complete URIs of running instances. The `application.yml` file contains Routes of other microservices.
![](misc/api-gateway-design.png)### Service Discovery
`eureka-server` uses `spring-cloud-starter-netflix-eureka-server` to register instance as server while other microservices `customer`, `fraud` uses `spring-cloud-starter-netflix-eureka-client` to register themselves as clients.#### Load Balancing
The `customer` microservice uses round-robin DNS load balancing algorithm to perform routing to x instance of `fraud` microservice. `CustomerConfig` class contains `restTemplate()` method which is annotated with `@LoadBalanced` to perform load balancing.#### Eureka Server connection pool
![](misc/eureka-server.png)### Distributed Tracing
#### Zipkin & Sleuth
Uses `spring-cloud-starter-sleuth` and `spring-cloud-sleuth-zipkin` across all microservices. Zipkin server runs via a Java jar on same machine. Zipkin can also be configured inside `docker-compose.yml` to run in Docker container. The default port of Zipkin server is `9411`.