The repository contains various project built to do a case study on "How to make microservices with Spring Boot? "
What is a Service ?
A piece of software to provide a particular functionality to different software/components in the application.
What is a Microservice ?
Some salient features of a microservice are :
- A service oriented architecture done well
- Efficiently scalable application
- High performance application
- Single service with a single focus/functionality to deliver
- Technology agnostic API
- Lightweight communication
- Independent data storage
- Independently changeable and deployable
What is the need for a Microservice ?
- To respond to required changes quickly or adapt rapidly
- For reliability, as each microservice only has single functionality, they are less prone to errors
- Automated CI/CD is easier with smaller components
- On demand hosting technology like Cloud Foundry, Heroku, Azure, GCP
- Shorter development times
- Decoupling of changeable parts
- Faster issue resolutions
Characteristics of a Microservice
Highly Cohesive (Single Focus) | Autonomous (Self reliable on serving requests) | Business Domain Driven |
Resiliency (able to serve with degraded func./ register -deregister) | Observable (monitoring, centralized logging) | Automation (CI/CD) |
TODO List
- add basic flow diagram
- add various components in each service
- show how zuul,config and discovery come into play
- Spring Boot - for rest api and various component development
- Actuator - for application metrics
- Spring Cloud
- Cloud Config Server - for central configuration management
- Cloud Config Client
- Spring Slueth - for tracing of various downstream calls, health metrics of service
- Cloud Bus - for refreshing configuration without restart
- Eureka Dicsovery - for API hearbeat registry
- Zuul API Gateway - For API proxy
- Zipkin Server - to view tracing data in timeline view
- Heroku - PAAS platform for deploying various applications
- Travis - For auto build and deploy from github
- LogDNA - For centralized logging from heroku
1. http://localhost/api/customer/customer-service
2. http://localhost/api/customer/customer-service/{emailId}
1. http://localhost/api/item/item-service
2. http://localhost/api/item/item-service/{item names}
1. http://localhost:8100/api/sales-order-service/order
Request Sample :
{
"orderDescription" : "test description",
"orderDate" : "2018-06-04",
"customerEmailId": "some.person@email.com",
"itemNames" : [ "Item1","Item3" ]
}
2. http://localhost:8100/api/sales-order-service/orderId/1
Response Sample :
{
"orderId": 1,
"customerEmailId": "some.person@email.com",
"orderDescription": "test description",
"orderDate": "2018-06-04T00:00:00.000+0000",
"totalPrice": 400,
"itemNames": [
"Item1",
"Item3"
]
}
- Zuul not able to route request to proper host
- Feign not able to pick correct server host from registry
- Trace log not showing up in zipkin ui
- Travis CI - Incorrect heroku key encryption