In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Original articles, welcome to reprint. Reprint please indicate: reproduced from IT Story Association, thank you!
Original link address: "Advanced articles" docker Development course Services (15)
Write the course service together this time. Before the user service, user EdgeSerivce, user information, have been developed, began to develop course services, the external is the dubbo interface, need to access the back-end database. Source code: https://github.com/limingios/msA-docker
Develop course service module
For dubbo-based services, the api interface is generally defined first, and the previous ones are all based on thrift. We first write a thrift file, and then upgrade it to the corresponding api,dubbo according to the configuration file. We are equivalent to writing an api module by hand.
Slightly more complex overall thinking
No longer copy the code, only through screenshots to describe the function, you can refer to the source code, this time with the last time springboot integrated dubbo.
Course-dubbo-service-api is the service responsible for providing the interface. Course-dubbo-service is the implementation of course-dubbo-service-api. Course-dubbo-service relies on the native DTO class of the original user-thrift-service-api and the method implementation in user-thrift-service. The invocation of user-thrift-service by course-dubbo-service is done in the same way as thrift. Because user-thrift-service itself generates the corresponding java class through thrift.
User-thrift-service and user-thrift-service-apiuser-thrift-service-api have modified the thrift and added the teacher's DTO and ID to obtain the user's information, so they need to re-generate the corresponding java class user-thrift-service through the thrift command to achieve a new interface to obtain the user's information through ID, and add an associated table teacher table to the UserMapperuser database.
The driver of springboot,mysql is introduced into course-dubbo-service-api and course-dubbo-servicecourse-dubbo-service pom, and the access service of thrift micro-service is injected into thrift,springboot-dubbo,user-thrift-service.jar,user-thrift-service-api.jarcourse-dubbo-service to access the micro-service of user-thrift-service for the tutorials information of teachers, through the way of thrift. Application.properties configuration dubbo configuration, database configuration Address and port of user-thrift-service org.springframework.boot spring-boot-starter-parent 1.5.3.RELEASE 4.0.0 com.idig8 course-dubbo-service 1.0-SNAPSHOT io.dubbo.springboot spring-boot-starter-dubbo 1.0.0 org.springframework .boot spring-boot-starter org.apache.thrift libthrift 0.10.0 org.mybatis.spring.boot mybatis-spring-boot-starter 1.3.1 mysql mysql-connector-java 5.1 . 44 com.idig8 course-dubbo-service-api 1.0-SNAPSHOT com.idig8 user-thrift-service 1.0-SNAPSHOT com.idig8 user-thrift-service-api 1.0-SNAPSHOT
PS: the basic idea of curriculum development is that other people have micro-service calls that only implement what they belong to.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.