In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you how to analyze SpringCloud service registration discovery and service consumption, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Overall structure (1)
Eurake creates a service registry for service registration and discovery. Eureka is a highly available component, and after any instance is registered, a heartbeat needs to be sent to the registry, and the whole process is done in memory.
Respectively start two services (respectively is the implementation of specific business logic), 8762 and 8763. Two instances are registered with the service registry.
Start the Ribbon load balancing service, register with the service registry, and discover the service. The role of Ribbon in this process is load balancing.
When the ribbon service invokes the interface to the ribbon load balancer through restTemplet, polling invokes the 8762 and 8763 instance interfaces.
Implementation process (2)
Why does feign appear after ribbon? (III)
Feign integrates ribbon and realizes the function of load balancing.
Feign is called through the interface and uses interface-based annotations, which is more concise than ribbon.
How to call ribbon:
@ Autowired RestTemplate restTemplate
@ HystrixCommand (fallbackMethod = "hiError") public String hiService (String name) {return restTemplate.getForObject ("http://SERVICE-HI/hi?name="+name,String.class);}"
The invocation method of feign (similar to the direct invocation of microservices):
FeignClient (value = "service-hi", fallback = SchedualServiceHystric.class) public interface SchedualServiceHi {@ RequestMapping (value = "/ hi", method = RequestMethod.GET) String sayHiFromClientOne (@ RequestParam (value = "name") String name);}
3. Feign integrates the circuit break mechanism of hystrix.
The above content is how to analyze SpringCloud service registration discovery and service consumption. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.