use of io.servicecomb.serviceregistry.api.response.GetExistenceResponse in project java-chassis by ServiceComb.
the class ServiceRegistryClientImpl method isSchemaExist.
@Override
public boolean isSchemaExist(String microserviceId, String schemaId) {
Holder<GetExistenceResponse> holder = new Holder<>();
IpPort ipPort = IpPortManager.INSTANCE.get();
CountDownLatch countDownLatch = new CountDownLatch(1);
RestUtils.get(ipPort, Const.MS_API_PATH + Const.EXISTENCE_PATH, new RequestParam().addQueryParam("type", "schema").addQueryParam("serviceId", microserviceId).addQueryParam("schemaId", schemaId), syncHandler(countDownLatch, GetExistenceResponse.class, holder));
try {
countDownLatch.await();
} catch (Exception e) {
LOGGER.error("query schema exist {}/{} fail", microserviceId, schemaId, e);
}
return holder.value != null;
}
use of io.servicecomb.serviceregistry.api.response.GetExistenceResponse in project java-chassis by ServiceComb.
the class ServiceRegistryClientImpl method getMicroserviceId.
@Override
public String getMicroserviceId(String appId, String microserviceName, String versionRule) {
Holder<GetExistenceResponse> holder = new Holder<>();
IpPort ipPort = IpPortManager.INSTANCE.get();
CountDownLatch countDownLatch = new CountDownLatch(1);
RestUtils.get(ipPort, Const.MS_API_PATH + Const.EXISTENCE_PATH, new RequestParam().addQueryParam("type", "microservice").addQueryParam("appId", appId).addQueryParam("serviceName", microserviceName).addQueryParam("version", versionRule), syncHandler(countDownLatch, GetExistenceResponse.class, holder));
try {
countDownLatch.await();
if (holder.value != null) {
return holder.value.getServiceId();
}
} catch (Exception e) {
LOGGER.error("query microservice id {}/{}/{} fail", appId, microserviceName, versionRule, e);
}
return null;
}
Aggregations