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
[SCB-1039]Add interface to compatible with ServiceCenter Aggregator #1007
Conversation
@@ -216,7 +216,7 @@ public static boolean updateInstanceProperties(Map<String, String> instancePrope | |||
} | |||
|
|||
public static Microservice getMicroservice(String microserviceId) { | |||
return serviceRegistry.getRemoteMicroservice(microserviceId); | |||
return serviceRegistry.getAggregatedRemoteMicroervice(microserviceId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not change this
@@ -58,6 +58,15 @@ MicroserviceInstances findServiceInstances(String appId, String microserviceName | |||
|
|||
Microservice getRemoteMicroservice(String microserviceId); | |||
|
|||
/** | |||
* <p> | |||
* if connect to simple ServiceCenter, same with the method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normal, not "sample"?
@@ -353,6 +358,16 @@ public String getSchema(String microserviceId, String schemaId) { | |||
return microservice.getSchemaMap().get(schemaId); | |||
} | |||
|
|||
@Override | |||
public String getAggregatedSchema(String microserviceId, String schemaId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not copy code
just invoke getSchema
@@ -188,6 +188,11 @@ public Microservice getMicroservice(String microserviceId) { | |||
return microserviceIdMap.get(microserviceId); | |||
} | |||
|
|||
@Override | |||
public Microservice getAggregatedMicroservice(String microserviceId) { | |||
return microserviceIdMap.get(microserviceId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not copy code
just invoke getMicroservice
|
||
@Override | ||
public String getAggregatedSchema(String microserviceId, String schemaId) { | ||
Holder<GetSchemaResponse> holder = new Holder<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not copy code
just make global to be a parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -489,7 +534,7 @@ public String registerMicroserviceInstance(MicroserviceInstance instance) { | |||
CountDownLatch countDownLatch = new CountDownLatch(1); | |||
RestUtils.get(ipPort, | |||
String.format(Const.REGISTRY_API.MICROSERVICE_INSTANCE_OPERATION_ALL, providerId), | |||
new RequestParam().addHeader("X-ConsumerId", consumerId), | |||
new RequestParam().addHeader("X-ConsumerId", consumerId).addQueryParam("global", "true"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to add global
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -795,7 +841,7 @@ public ServiceCenterInfo getServiceCenterInfo() { | |||
CountDownLatch countDownLatch = new CountDownLatch(1); | |||
RestUtils.get(ipPort, | |||
Const.REGISTRY_API.SERVICECENTER_VERSION, | |||
new RequestParam(), | |||
new RequestParam().addQueryParam("global", "true"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to add global
return doGetSchema(microserviceId, schemaId, false); | ||
} | ||
|
||
private String doGetSchema(String microserviceId, String schemaId, boolean isAggregatedServiceCenter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not "isAggregatedServiceCenter"
target is ServiceCenter Aggregator:
1.for register flow, global=false
2.for find instance flow, global=true
so the variable name better to be: global
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i will change it
Why we need to distinguish from register & find flow? I think service center knows the request is register or find. |
@wujimin I do not know the details very clearly |
both register and find instance flow, need to invoke getMicroservice/getSchema ServiceCenter can not know the scenes, so need client invoke with the flag |
Follow this checklist to help us incorporate your contribution quickly and easily:
[SCB-XXX] Fixes bug in ApproximateQuantiles
, where you replaceSCB-XXX
with the appropriate JIRA issue.mvn clean install
to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.