当前位置:网站首页>Service address dynamic awareness of Nacos registry
Service address dynamic awareness of Nacos registry
2022-07-25 01:06:00 【InfoQ】
nacos The service address of the registry is dynamically aware
Implement monitoring
call subscribe Method
void subscribe(String serviceName, EventListener listener) throws NacosException;
NamingService naming2 = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
naming2.subscribe(serviceName, new EventListener() {
@Override
public void onEvent(Event event) {
System.out.println(((NamingEvent) event).getServiceName());
System.out.println(((NamingEvent) event).getInstances());
instances = ((NamingEvent) event).getInstances();
}
});
call selectInstances Method
List<Instance> selectInstances(String serviceName, String groupName, List<String> clusters, boolean healthy, boolean subscribe) throws NacosException;
selectInstances(serviceName, clusters, healthy, true)
Principle of service dynamic perception

- After the client initiates the event subscription ,HostReactor There is UpdateTask Threads , Every time 10s Send it once Pull request , Get the latest address list of the server
- Heartbeat detection is maintained between the server and the instance of the service provider , Once the service provider has an exception , Will send a Push A message to Nacos client , That is to serve consumers
- After the service consumer receives the request , Use HostReactor Of processServiceJSON Method parses the message , Update local service address list .
️ Thank you for your
- Welcome to follow me ️, give the thumbs-up , Comment on , forward
- Focus on
Panpan small class, Push good articles for you regularly , There are also group chat and irregular lottery activities , You can say what you want , Communicate with the great gods , Learning together .
边栏推荐
- asp rs.open sql,conn,3,1中3,1代表什么?
- Luo min cannot become Dong Yuhui
- Cloud native observability tracking technology in the eyes of Baidu engineers
- How to implement the server anti blackmail virus system is a problem we have to consider
- Pytorch structure reparameterization repvggblock
- C language force buckle the eleventh question to find the maximum capacity of the bucket. (two methods)
- paddlepaddle论文系列之Alexnet详解(附源码)
- Advanced multithreading (Part 2)
- How to implement a state machine?
- The leftmost prefix principle of MySQL
猜你喜欢

Automated test series selenium three kinds of waiting for detailed explanation

Human cell prosci 4-1BB ligand recombinant protein scheme

Document the use of anti shake in packaged components and projects
![Nacos hand to hand teaching [i] dynamic configuration of Nacos](/img/c4/ae29475c795e879683227de5ba3cfc.png)
Nacos hand to hand teaching [i] dynamic configuration of Nacos

Prosci 14-3-3 (phosphate ser58) antibody instructions

Join MotoGP Monster Energy British Grand Prix!

Example analysis of recombinant monoclonal antibody prosci CD154 antibody
![[25. Hash table]](/img/c4/1500d070d44d3bd84eb141ed38013d.png)
[25. Hash table]

Prosci anti-CD22 antibody epratuzum28 flow cytometry display

Unity panel control
随机推荐
C recursively obtains all files under the folder and binds them to the treeview control
Big talk · book sharing | Haas Internet of things device cloud integrated development framework
Pychart exits pytest mode (run pytest in mode)
Brush questions of binary tree (5)
Join MotoGP Monster Energy British Grand Prix!
Prosci anti-CD22 antibody epratuzum28 flow cytometry display
[29. DFS depth is preferred]
Research and Multisim Simulation of linear circuit characteristics (engineering documents attached)
7.24 party notice
Automated test series selenium three kinds of waiting for detailed explanation
Example analysis of recombinant monoclonal antibody prosci CD154 antibody
WhatsApp web for usability testing of software testing technology
Tool use of rookie tutorial -- View subclass (implementation class) class diagram in idea
Fabric. JS centered element
Worthington carboxyl transfer carbonic anhydrase application and literature reference
Young people who lost the IPO
JS convert pseudo array to array
What is iftmcs indicating contract status message?
Luo min cannot become Dong Yuhui
Amd epyc 9654 Genoa CPU cache test exposure L1 bandwidth up to 30tb/s