use of org.apache.servicecomb.registry.lightweight.store.MicroserviceStore in project java-chassis by ServiceComb.
the class StoreService method addMicroserviceAndInstance.
private CompletableFuture<InstanceStore> addMicroserviceAndInstance(Endpoint endpoint, RegisterRequest request) {
return discoveryClient.getInfoAsync(endpoint, request.getServiceId()).thenApply(info -> {
info.getMicroservice().getSchemaMap().putAll(info.getSchemasById());
MicroserviceStore microserviceStore = store.addMicroservice(info.getMicroservice(), request.getSchemasSummary());
InstanceStore instanceStore = doAddInstance(microserviceStore, info.getInstance());
LOGGER.info("add microservice and instance, serviceId={}, instanceId={}, endpoints={}", request.getServiceId(), request.getInstanceId(), request.getEndpoints());
return instanceStore;
});
}
use of org.apache.servicecomb.registry.lightweight.store.MicroserviceStore in project java-chassis by ServiceComb.
the class StoreService method addInstance.
private CompletableFuture<InstanceStore> addInstance(RegisterRequest request) {
Endpoint endpoint = request.selectFirstEndpoint();
if (endpoint == null) {
return AsyncUtils.completeExceptionally(new RegisterException("can not select endpoint"));
}
MicroserviceStore microserviceStore = this.store.findMicroserviceStore(request.getServiceId());
if (microserviceStore == null) {
return addMicroserviceAndInstance(endpoint, request);
}
return checkSchemaSummary(request, microserviceStore).thenCompose(v -> discoveryClient.getInstanceAsync(endpoint, request.getServiceId())).thenApply(instance -> addInstance(microserviceStore, instance));
}
use of org.apache.servicecomb.registry.lightweight.store.MicroserviceStore in project incubator-servicecomb-java-chassis by apache.
the class StoreService method addMicroserviceAndInstance.
private CompletableFuture<InstanceStore> addMicroserviceAndInstance(Endpoint endpoint, RegisterRequest request) {
return discoveryClient.getInfoAsync(endpoint, request.getServiceId()).thenApply(info -> {
info.getMicroservice().getSchemaMap().putAll(info.getSchemasById());
MicroserviceStore microserviceStore = store.addMicroservice(info.getMicroservice(), request.getSchemasSummary());
InstanceStore instanceStore = doAddInstance(microserviceStore, info.getInstance());
LOGGER.info("add microservice and instance, serviceId={}, instanceId={}, endpoints={}", request.getServiceId(), request.getInstanceId(), request.getEndpoints());
return instanceStore;
});
}
Aggregations