chapter one
This chapter covers:
- Understanding microservices and their core characteristics
- Examining the benefits and drawbacks of microservices
- An example of microservices working in concert to serve a user request
- Using ASP.NET Core for a simple application
In this chapter, I’ll explain what microservices are and demonstrate why they’re interesting. We’ll also look at the six characteristics of a microservice. Finally, I’ll introduce you to the most important technologies we’ll use in this book: .NET Core and MVC Core.
A microservice is a service with one, and only one, very narrowly focused capability that a remote API exposes to the rest of the system. For example, think of a system for managing a warehouse. If you broke down its capabilities, you might come up with the following list:
- Receive stock arriving at the warehouse.
- Determine where new stock should be stored.
- Calculate placement routes inside the warehouse for putting stock into the right storage units.
- Assign placement routes to warehouse employees.
- Receive orders.
- Calculate pick routes in the warehouse for a set of orders.
- Assign pick routes to warehouse employees.
Let’s consider how the first of these capabilities—receive stock arriving at the warehouse—would be implemented as a microservice. We’ll call it the Receive Stock microservice: