Spring Cloud Microservices Tutorial Series

Okan Ardıç
2 min readOct 12, 2022

--

In this tutorial series, we will talk about the following topics that are used to develop microservices with Spring Cloud:

  • Service Discovery
  • Request routing
  • Service-to-service calls
  • Load balancing
  • Distributed Tracing
  • Circuit Breaker pattern
  • Retrying service-to-service calls

We will develop 3 microservices to list users, list user orders, view order details etc:

User Service: Used to retrieve user details along with their orders. A sample user record looks like the following:

{
"id": 1,
"name": "Joe",
"orders": [
{
"id": 11,
"userId": 1,
"price": 1250,
"orderTime": "2022-10-11T11:41:44.085868100Z"
},
{
"id": 10,
"userId": 1,
"price": 100,
"orderTime": "2022-10-11T11:41:44.085868100Z"
}
]
}

Order Service: Used to retrieve previous orders of users. Order Service internally calls Product Service to get the product details for the purchased items. Order details for a specific order look like the following:

[
{
"id": 100,
"orderId": 10,
"productId": 1000,
"product": {
"id": 1000,
"name": "pencil",
"quantity": 500
},
"quantity": 3,
"unitPrice": 0.7
},
{
"id": 101,
"orderId": 10,
"productId": 1001,
"product": {
"id": 1001,
"name": "book",
"quantity": 100
},
"quantity": 1,
"unitPrice": 8
}
]

Product Service: Used to retrieve product details. A sample product record looks like the following:

{
"id": 1000,
"name": "pencil",
"quantity": 500,
"unitPrice": 0.7
}

--

--