Search in sources :

Example 1 with Builder

use of com.logicalclocks.servicediscoverclient.Builder in project hopsworks by logicalclocks.

the class Settings method getAlertManagerService.

private static Optional<Service> getAlertManagerService(String serviceFQDN) throws ServiceDiscoveryException {
    ServiceDiscoveryClient client = null;
    Optional<Service> services;
    try {
        client = new Builder(Type.DNS).build();
        String name = Strings.isNullOrEmpty(serviceFQDN) ? DEFAULT_ALERTMANAGER_FQDN : serviceFQDN;
        services = client.getService(ServiceQuery.of(name, Collections.emptySet())).findFirst();
    } finally {
        if (client != null) {
            client.close();
        }
    }
    return services;
}
Also used : ServiceDiscoveryClient(com.logicalclocks.servicediscoverclient.ServiceDiscoveryClient) Builder(com.logicalclocks.servicediscoverclient.Builder) UriBuilder(javax.ws.rs.core.UriBuilder) Service(com.logicalclocks.servicediscoverclient.service.Service)

Aggregations

Builder (com.logicalclocks.servicediscoverclient.Builder)1 ServiceDiscoveryClient (com.logicalclocks.servicediscoverclient.ServiceDiscoveryClient)1 Service (com.logicalclocks.servicediscoverclient.service.Service)1 UriBuilder (javax.ws.rs.core.UriBuilder)1