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

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.

主站蜘蛛池模板: 孝昌县| 房山区| 扎鲁特旗| 襄垣县| 荔波县| 沅江市| 二连浩特市| 舞阳县| 漯河市| 永福县| 安义县| 柘荣县| 灵石县| 大兴区| 安溪县| 大连市| 宽甸| 广元市| 南投县| 安化县| 荣昌县| 循化| 乌鲁木齐县| 九江市| 桃源县| 雅江县| 中阳县| 博爱县| 定州市| 黄平县| 漳平市| 铜鼓县| 汝州市| 广宁县| 印江| 吐鲁番市| 贺兰县| 舟山市| 泉州市| 上高县| 佛学|