public ZookeeperFileConfigurationRepository(
            Cache.IOcelotCache <FileConfiguration> cache,
            IInternalConfigurationRepository repo,
            IZookeeperClientFactory factory,
            IOcelotLoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger <ZookeeperFileConfigurationRepository>();
            _cache  = cache;

            var internalConfig = repo.Get();

            _configurationKey = "InternalConfiguration";

            string token = null;

            if (!internalConfig.IsError)
            {
                token             = internalConfig.Data.ServiceProviderConfiguration.Token;
                _configurationKey = !string.IsNullOrEmpty(internalConfig.Data.ServiceProviderConfiguration.ConfigurationKey) ?
                                    internalConfig.Data.ServiceProviderConfiguration.ConfigurationKey : _configurationKey;
            }

            var config = new ZookeeperRegistryConfiguration(
                internalConfig.Data.ServiceProviderConfiguration.Host,
                internalConfig.Data.ServiceProviderConfiguration.Port, _configurationKey);

            _ZookeeperClient = factory.Get(config);
        }
 public ZookeeperClient Get(ZookeeperRegistryConfiguration config)
 {
     return(new ZookeeperClient($"{config.Host}:{config.Port}"));
 }
Exemple #3
0
 public Zookeeper(ZookeeperRegistryConfiguration config, IOcelotLoggerFactory factory, IZookeeperClientFactory clientFactory)
 {
     _logger          = factory.CreateLogger <Zookeeper>();
     _config          = config;
     _zookeeperClient = clientFactory.Get(_config);
 }