use of com.ecwid.consul.v1.catalog.model.CatalogService in project motan by weibocom.
the class ConsulRegistryService method getServicesByGroup.
@Override
public List<String> getServicesByGroup(String dcGroup) {
Set<String> services = new HashSet<String>();
List<CatalogService> serviceList = getCatalogServicesByGroup(dcGroup);
for (CatalogService service : serviceList) {
services.add(formatServiceName(service));
}
return new ArrayList<String>(services);
}
use of com.ecwid.consul.v1.catalog.model.CatalogService in project cloudbreak by hortonworks.
the class ConsulServiceCheckerTask method checkStatus.
@Override
public boolean checkStatus(ConsulContext consulContext) {
String serviceName = consulContext.getTargets().get(0);
ConsulClient client = consulContext.getConsulClient();
LOGGER.info("Checking consul service registration of '{}'", serviceName);
List<CatalogService> service = ConsulUtils.getService(Collections.singletonList(client), serviceName);
if (service.isEmpty()) {
LOGGER.info("Consul service '{}' is not registered yet", serviceName);
return false;
} else {
LOGGER.info("Consul service '{}' found on '{}'", serviceName, service.get(0).getNode());
return true;
}
}
Aggregations