use of com.netflix.client.config.IClientConfigKey in project camel by apache.
the class RibbonLoadBalancer method createLoadBalancer.
// ************************
// Helpers
// ************************
private ZoneAwareLoadBalancer<RibbonServiceDefinition> createLoadBalancer(String serviceName, ServiceDiscovery serviceDiscovery) {
// setup client config
IClientConfig config = configuration.getClientName() != null ? IClientConfig.Builder.newBuilder(configuration.getClientName()).build() : IClientConfig.Builder.newBuilder().build();
if (configuration.getClientConfig() != null) {
for (Map.Entry<String, String> entry : configuration.getClientConfig().entrySet()) {
IClientConfigKey key = IClientConfigKey.Keys.valueOf(entry.getKey());
String value = entry.getValue();
LOGGER.debug("RibbonClientConfig: {}={}", key.key(), value);
config.set(key, value);
}
}
return new ZoneAwareLoadBalancer<>(config, configuration.getRuleOrDefault(RoundRobinRule::new), configuration.getPingOrDefault(DummyPing::new), new RibbonServerList(serviceName, serviceDiscovery, serviceFilter), null, new PollingServerListUpdater(config));
}
use of com.netflix.client.config.IClientConfigKey in project ribbon by Netflix.
the class ExecutionContextListenerInvoker method isListenerDisabled.
private boolean isListenerDisabled(ExecutionListener<?, ?> listener) {
if (clientConfig == null) {
return false;
} else {
String className = listener.getClass().getName();
IClientConfigKey key = classConfigKeyMap.get(className);
if (key == null) {
key = CommonClientConfigKey.valueOf("listener." + className + ".disabled");
IClientConfigKey old = classConfigKeyMap.putIfAbsent(className, key);
if (old != null) {
key = old;
}
}
return clientConfig.getPropertyAsBoolean(key, false);
}
}
Aggregations