use of org.apache.servicecomb.localregistry.RegistryBean.Instance in project java-chassis by ServiceComb.
the class RegistryBeansConfiguration method demoLocalRegistryServerBean.
@Bean
public RegistryBean demoLocalRegistryServerBean() {
List<String> endpoints = new ArrayList<>();
endpoints.add("rest://localhost:8080");
List<Instance> instances = new ArrayList<>();
instances.add(new Instance().setEndpoints(endpoints));
return new RegistryBean().setServiceName("demo-local-registry-server-bean").setId("002").setVersion("0.0.3").setAppId("demo-local-registry").addSchemaId("ServerEndpoint").addSchemaId("CodeFirstEndpoint").setInstances(new Instances().setInstances(instances));
}
use of org.apache.servicecomb.localregistry.RegistryBean.Instance in project java-chassis by ServiceComb.
the class LocalRegistryStore method addInstances.
private void addInstances(RegistryBean bean, Microservice microservice) {
Map<String, MicroserviceInstance> instanceMap = new ConcurrentHashMap<>();
microserviceInstanceMap.put(microservice.getServiceId(), instanceMap);
for (Instance item : bean.getInstances().getInstances()) {
MicroserviceInstance instance = new MicroserviceInstance();
instance.setInstanceId(UUID.randomUUID().toString());
instance.setEndpoints(item.getEndpoints());
instance.setServiceId(microservice.getServiceId());
instanceMap.put(instance.getInstanceId(), instance);
}
}
Aggregations