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

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.

主站蜘蛛池模板: 肥西县| 蒙阴县| 常州市| 福州市| 邮箱| 文化| 巨野县| 西乌珠穆沁旗| 蛟河市| 攀枝花市| 沅江市| 泗洪县| 苗栗县| 乌拉特中旗| 庆云县| 青海省| 潮州市| 石屏县| 辽宁省| 冷水江市| 永寿县| 法库县| 通河县| 郯城县| 南乐县| 铜鼓县| 大田县| 饶河县| 定远县| 黄浦区| 龙胜| 英吉沙县| 大同县| 印江| 育儿| 军事| 景谷| 琼海市| 阜宁县| 巴林左旗| 河西区|