1. spring-cloud-commons 包
org.springframework.cloud.client.discovery.DiscoveryClient
org.springframework.cloud.client.serviceregistry.ServiceRegistry
2. eureka client service registration
@startuml
EurekaAutoServiceRegistration -> EurekaServiceRegistry : register(EurekaRegistration reg)
EurekaServiceRegistry -> ApplicationInfoManager: setInstanceStatus(InstanceStatus status)
ApplicationInfoManager -> DiscoveryClient : initScheduledTasks()
DiscoveryClient -> DiscoveryClient: notify(StatusChangeEvent statusChangeEvent)
DiscoveryClient -> instanceInfoReplicator : onDemandUpdate()
instanceInfoReplicator -> instanceInfoReplicator : run()
instanceInfoReplicator -> discoveryClient : register()
discoveryClient -> EurekaHttpClientDecorator: register(final InstanceInfo info)
@enduml
3. erueka client service discovery
Put the obtained service into the local variable this.localRegionApps
@startuml
EurekaClientAutoConfiguration -> CloudEurekaClient : eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config)
CloudEurekaClient -> DiscoveryClient: public CloudEurekaClient(ApplicationInfoManager applicationInfoManager, EurekaClientConfig config, AbstractDiscoveryClientOptionalArgs<?> args, ApplicationEventPublisher publisher)
DiscoveryClient -> DiscoveryClient : initScheduledTasks()
DiscoveryClient -> DiscoveryClient.CacheRefreshThread: run()
DiscoveryClient -> DiscoveryClient : refreshRegistry()
DiscoveryClient -> DiscoveryClient : getAndStoreFullRegistry()
@enduml
4. eureka-ribbon
@startuml
RibbonClientConfiguration -> ZoneAwareLoadBalancer : ribbonLoadBalancer()
ZoneAwareLoadBalancer -> ZoneAwareLoadBalancer: ZoneAwareLoadBalancer()
ZoneAwareLoadBalancer -> DynamicServerListLoadBalancer : DynamicServerListLoadBalancer()
DynamicServerListLoadBalancer -> DynamicServerListLoadBalancer: restOfInit()
DynamicServerListLoadBalancer -> DynamicServerListLoadBalancer : enableAndInitLearnNewServersFeature()
DynamicServerListLoadBalancer -> DynamicServerListLoadBalancer : start()
DynamicServerListLoadBalancer -> DynamicServerListLoadBalancer : updateListOfServers()
DynamicServerListLoadBalancer -> DomainExtractingServerList : getUpdatedListOfServers()
DynamicServerListLoadBalancer -> DiscoveryEnabledNIWSServerList : obtainServersViaDiscovery()
DiscoveryEnabledNIWSServerList -> DiscoveryClient : getInstancesByVipAddress()
@enduml
getInstancesByVipAddress Gets the corresponding service information from the local variable this.localRegionApps