|
|
|
@ -36,6 +36,7 @@ import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
@ -49,6 +50,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.cloud.client.ServiceInstance;
|
|
|
|
|
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
|
|
|
|
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
|
|
|
|
import org.springframework.cloud.commons.util.InetUtils;
|
|
|
|
|
import org.springframework.context.ApplicationEvent;
|
|
|
|
|
import org.springframework.context.ApplicationEventPublisher;
|
|
|
|
@ -165,6 +167,9 @@ public class DubboServiceMetadataRepository
|
|
|
|
|
@Autowired
|
|
|
|
|
private DiscoveryClient discoveryClient;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private LoadBalancerClient loadBalancerClient;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private JSONUtils jsonUtils;
|
|
|
|
|
|
|
|
|
@ -618,7 +623,7 @@ public class DubboServiceMetadataRepository
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void initSubscribedDubboMetadataService(String serviceName) {
|
|
|
|
|
discoveryClient.getInstances(serviceName).stream().findAny()
|
|
|
|
|
Optional.ofNullable(loadBalancerClient.choose(serviceName))
|
|
|
|
|
.map(this::getDubboMetadataServiceURLs)
|
|
|
|
|
.ifPresent(dubboMetadataServiceURLs -> {
|
|
|
|
|
dubboMetadataServiceURLs.forEach(dubboMetadataServiceURL -> {
|
|
|
|
|