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

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.

主站蜘蛛池模板: 新晃| 隆化县| 绥棱县| 武威市| 万安县| 临夏市| 惠来县| 柳林县| 河池市| 漳州市| 裕民县| 永福县| 土默特右旗| 阜宁县| 栾城县| 会东县| 汉源县| 呼玛县| 桓台县| 兴义市| 高州市| 天津市| 永定县| 台中县| 方正县| 东莞市| 景洪市| 教育| 故城县| 太和县| 龙口市| 扬州市| 麻栗坡县| 大田县| 兴安县| 玉门市| 彰武县| 梅河口市| 朝阳县| 泰州市| 阿克陶县|