当前位置:   article > 正文

SpringCloud源码学习_preserved.register.source

preserved.register.source

Nacos 设计模型

nameSpace->group->Service/DataId

 Nacos 服务领域模型

 

 

  1. @Autowired
  2. private LoadBalancerClient loadBalancerClient;
  3. @Autowired
  4. private RestTemplate restTemplate;
  5. //获取服务实例,使用负载均衡客户端根据服务名选择实例
  6. ServiceInstance serviceInstance = loadBalancerClient.choose("dubbo-provider");
  7. URI uri = serviceInstance.getUri();
  8. //ip+端口号
  9. restTemplate.getForObject(uri+"/student/list",String.class);
  10. //参数详情
  11. {"host":"2.0.3.92","instanceId":"2.0.3.92:20880","metadata":{"dubbo.metadata-service.urls":"[ \"dubbo://2.0.3.92:20880/com.alibaba.cloud.dubbo.service.DubboMetadataService?anyhost=true&application=dubbo-provider&bind.ip=2.0.3.92&bind.port=20880&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=dubbo-provider&interface=com.alibaba.cloud.dubbo.service.DubboMetadataService&metadata-type=remote&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=39176&qos.enable=false&release=2.7.8&revision=2.2.2.RELEASE&side=provider&timestamp=1644200749402&version=1.0.0\" ]","preserved.register.source":"SPRING_CLOUD","dubbo.protocols.dubbo.port":"20880"},"port":20880,"secure":false,"server":{"alive":true,"host":"2.0.3.92","hostPort":"2.0.3.92:20880","id":"2.0.3.92:20880","instance":{"clusterName":"DEFAULT","enabled":true,"ephemeral":true,"healthy":true,"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"instanceId":"2.0.3.92#20880#DEFAULT#DEFAULT_GROUP@@dubbo-provider","ip":"2.0.3.92","ipDeleteTimeout":30000,"metadata":{"$ref":"$.metadata"},"port":20880,"serviceName":"DEFAULT_GROUP@@dubbo-provider","weight":1.0},"metaInfo":{"appName":"DEFAULT_GROUP@@dubbo-provider","instanceId":"2.0.3.92#20880#DEFAULT#DEFAULT_GROUP@@dubbo-provider"},"metadata":{"$ref":"$.metadata"},"port":20880,"readyToServe":true,"zone":"UNKNOWN"},"serviceId":"dubbo-provider","uri":"http://2.0.3.92:20880"}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/978661
推荐阅读
相关标签
  

闽ICP备14008679号