Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

APIGateway of docker (17)

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Original articles, welcome to reprint. Reprint please indicate: reproduced from IT Story Association, thank you!

Original link address: APIGateway of docker (17)

This time, let's talk about the last module, APIGateway, whose function is to uniformly forward our client's request to the EdgeService of the user and the course. We use springClud to implement ApiGetway. Source code: https://github.com/limingios/msA-docker

Use springClud to create a new project for routing and forwarding function

Org.springframework.boot spring-boot-starter-parent 1.5.3.RELEASE 4.0.0 com.idig8 api-gateway-zuul 1.0-SNAPSHOT org.springframework.boot spring-boot-starter-web org.springframework.cloud spring-cloud-starter-zuul 1.3.5.RELEASE Server.port=8080zuul.routes.course.path=/course/**zuul.routes.course.url= http://127.0.0.1:8081/course/zuul.routes.user.path=/user/**zuul.routes.user.url=http://127.0.0.1:8082/user/package com.idig8.zuul Import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.netflix.zuul.EnableZuulProxy;/** * Created by liming * / @ SpringBootApplication@EnableZuulProxypublic class ServiceApplication {public static void main (String args []) {SpringApplication.run (ServiceApplication.class, args);}}

Comb the train of thought

After all the business has been developed, zuul can help us to do the routing and forwarding work. All the requests to help you do the transit. Although the business is very simple, the framework can be implemented. Business is not the focus of this study of microservices. In the whole development process, I mainly want to let you feel the micro-services, different RPC communication methods, have not used dubbo and thrift can understand how to use. Also engaged in boast language business communication, using python to write a message message service, using java as the client to call python, in which the java module we use springboot, to enter a breakthrough point, we can feel the unity of development and configuration patterns. Finally, we use zuul as the service gateway to complete the service routing. We can notice that all services are developed using relatively simple models and functions. There are no big and comprehensive characters, because this time it is mainly about opening a door to micro-services for those who don't know much about micro-services.

PS: just like making friends with strangers, it is impossible to introduce yourself directly and in detail. We usually talk about something else first, or start from a topic that everyone is interested in to increase our understanding of each other little by little. In fact, learning is the same. A new function must have new functions and features. We must start from one point, use it first, and then understand it a little bit, just like this zuul. Only use his service routing, next time we will use these micro-services as the basis for docker, let the old man know how a non-docker project runs on a docker. What you need to care about is above. Then let's get all these services running locally. Finally, we hand it over to the service choreography framework to see how it schedules and manages the container.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report