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);
}
}
Aggregations