Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable setting a EurekaClient instance in DiscoveryManager #1417

Merged
merged 2 commits into from
Aug 5, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
public class DiscoveryManager {
private static final Logger logger = LoggerFactory.getLogger(DiscoveryManager.class);
private DiscoveryClient discoveryClient;
private EurekaClient eurekaClient; // Might be a proxy to DiscoveryClient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you call it something like clientOverride?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


private EurekaInstanceConfig eurekaInstanceConfig;
private EurekaClientConfig eurekaClientConfig;
Expand All @@ -58,6 +59,10 @@ public void setDiscoveryClient(DiscoveryClient discoveryClient) {
this.discoveryClient = discoveryClient;
}

public void setEurekaClient(EurekaClient eurekaClient) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here (setClientOverride).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

this.eurekaClient = eurekaClient;
}

public void setEurekaClientConfig(EurekaClientConfig eurekaClientConfig) {
this.eurekaClientConfig = eurekaClientConfig;
}
Expand Down Expand Up @@ -107,7 +112,7 @@ public void shutdownComponent() {
}

public LookupService getLookupService() {
return discoveryClient;
return getEurekaClient();
}

/**
Expand All @@ -127,6 +132,9 @@ public DiscoveryClient getDiscoveryClient() {
* @return the client that is used to talk to eureka.
*/
public EurekaClient getEurekaClient() {
if (eurekaClient != null) {
return eurekaClient;
}
return discoveryClient;
}

Expand Down