官术网_书友最值得收藏!

Implementing a Microservice

This chapter takes you from the design stage to the implementation of our sample project—an online table reservation system (OTRS). Here, you will use the same design we explained in the last chapter and enhance it to build microservices. By the end of this chapter, you will have not only learned how to implement the design, but also the different aspects of microservices—building, testing, packaging, and containerization. Although the focus is on building and implementing the restaurant microservices, you can use the same approach to build and implement other microservices that are used in the OTRS. Sample code available on GitHub provides all three services in this chapter—the restaurant service, the booking service, and the user service.

In this chapter, we will cover the following topics:

  • OTRS overview
  • Developing and implementing the microservices
  • Testing
  • Containerization of microservices using Docker

We will use the concepts of domain-driven design that were demonstrated in the last chapter. In the last chapter, you saw how domain-driven design is used to develop the domain model using core Java. Now, we will move from a sample domain implementation to a Spring Framework-driven implementation. You'll make use of Spring Boot to implement the domain-driven design concepts and transform them from core Java to a Spring Framework-based model.

In addition, we'll also use Spring Cloud, which provides a cloud-ready solution that is available through Spring Boot. Spring Boot will allow you to use an embedded application container relying on Tomcat or Jetty inside your service, which is packaged as a JAR or as a WAR. This JAR is executed as a separate process, a microservice that will serve and provide the responses to all requests and point to endpoints that are defined in the service.

Spring Cloud can also be integrated easily with Netflix Eureka, a service registry and discovery component. The OTRS will use it for the registration and the discovery of microservices.

主站蜘蛛池模板: 文水县| 长沙市| 英吉沙县| 登封市| 龙里县| 沈阳市| 嘉黎县| 芜湖县| 潼关县| 河津市| 庆云县| 沾化县| 基隆市| 延庆县| 芜湖县| 桃园县| 如东县| 邮箱| 临颍县| 壤塘县| 临朐县| 定结县| 莆田市| 溧水县| 呼和浩特市| 临泉县| 山东省| 志丹县| 长宁县| 剑河县| 岳池县| 赞皇县| 开封县| 二连浩特市| 云和县| 伊金霍洛旗| 东明县| 大埔区| 孟津县| 清河县| 开江县|