Code challenge to create an API using Java.
The API's implementation was divided in 4 phases:
-
- Create the services: Product, Customer and Order
-
- Add service discovery, centralised configuration and load balancer (client-side)
-
- Create api gateway and a authentication service
-
- Configure and collect metrics and tracing from all services
All services are based on Spring Boot and Spring Cloud.
Service discovery uses Netflix Eureka.
Client-side Load Balancer uses Netflix Ribbon.
Metrics will be stored into Prometheus and tracing into Zipkin.
There's a very simple presention about this project.
- Add initial services: Product, Customer and Order
- Add some tests to all services
- Create a service discovery service
- Change order service to call the customer service using client-side load balancing
- Create initial version of auth service
- Finish the API
- Add some kind of documentation (Swagger)
- Add more tests
- Add centralised configuration service
- Create API Gateway
- Finish auth service, and add tests to it
- Configure metrics on all services
- Configure tracing on all services
To install, clone this repository:
git clone https://github.com/rlazoti/hackathon-java-api
cd hackathon-java-api
mvn clean package
After that, run the services using the folowing commands:
java -jar eureka-service/target/eureka-service-1.0.0.jar
java -jar customer-service/target/customer-service-1.0.0.jar
java -jar order-service/target/order-service-1.0.0.jar
java -jar product-service/target/product-service-1.0.0.jar
To open Eureka, access: http://localhost:8761/
Example of requests to some services:
curl -v http://localhost:8080/api/v1/Customer/1
curl -v http://localhost:8082/api/v1/Order/1
-Rodrigo Lazoti