Search in sources :

Example 1 with CatalogOptions

use of com.orbitz.consul.option.CatalogOptions in project wildfly-swarm by wildfly-swarm.

the class CatalogWatcher method setupWatcher.

private void setupWatcher(String serviceName) {
    if (watchers.containsKey(serviceName)) {
        return;
    }
    CatalogOptions options = ImmutableCatalogOptions.builder().build();
    ServiceHealthCache healthCache = ServiceHealthCache.newCache(this.healthClientInjector.getValue(), serviceName, true, options, 5);
    try {
        healthCache.addListener(new ServiceCacheListener(serviceName, this.topologyManagerInjector.getValue()));
        healthCache.start();
        healthCache.awaitInitialized(1, TimeUnit.SECONDS);
        this.watchers.put(serviceName, healthCache);
    } catch (Exception e) {
        ConsulTopologyMessages.MESSAGES.errorSettingUpCatalogWatcher(serviceName, e);
    }
}
Also used : CatalogOptions(com.orbitz.consul.option.CatalogOptions) ImmutableCatalogOptions(com.orbitz.consul.option.ImmutableCatalogOptions) ServiceHealthCache(com.orbitz.consul.cache.ServiceHealthCache) StartException(org.jboss.msc.service.StartException)

Aggregations

ServiceHealthCache (com.orbitz.consul.cache.ServiceHealthCache)1 CatalogOptions (com.orbitz.consul.option.CatalogOptions)1 ImmutableCatalogOptions (com.orbitz.consul.option.ImmutableCatalogOptions)1 StartException (org.jboss.msc.service.StartException)1