public HobknobClient Create(string etcdHost, int etcdPort, string applicationName, TimeSpan cacheUpdateInterval)
        {
            var etcdKeysPath = string.Format("http://{0}:{1}/v2/keys/", etcdHost, etcdPort);

            var etcdClient = new EtcdClient(new Uri(etcdKeysPath));
            var featureToggleProvider = new FeatureToggleProvider(etcdClient, applicationName);
            var featureToggleCache = new FeatureToggleCache(featureToggleProvider, cacheUpdateInterval);
            var hobknobClient = new HobknobClient(featureToggleCache, applicationName);

            featureToggleCache.Initialize();

            return hobknobClient;
        }
Ejemplo n.º 2
0
        public HobknobClient Create(string etcdHost, int etcdPort, string applicationName, TimeSpan cacheUpdateInterval)
        {
            var etcdKeysPath = string.Format("http://{0}:{1}/v2/keys/", etcdHost, etcdPort);

            var etcdClient            = new EtcdClient(new Uri(etcdKeysPath));
            var featureToggleProvider = new FeatureToggleProvider(etcdClient, applicationName);
            var featureToggleCache    = new FeatureToggleCache(featureToggleProvider, cacheUpdateInterval);
            var hobknobClient         = new HobknobClient(featureToggleCache, applicationName);

            featureToggleCache.Initialize();

            return(hobknobClient);
        }
Ejemplo n.º 3
0
        public IHobknobClient Create(string etcdHost, int etcdPort, string applicationName, TimeSpan cacheUpdateInterval, EventHandler <CacheUpdateFailedArgs> cacheUpdateFailed)
        {
            var etcdKeysPath = string.Format("http://{0}:{1}/v2/keys/", etcdHost, etcdPort);

            var etcdClient            = new EtcdClient(new Uri(etcdKeysPath));
            var featureToggleProvider = new FeatureToggleProvider(etcdClient, applicationName);
            var featureToggleCache    = new FeatureToggleCache(featureToggleProvider, cacheUpdateInterval);
            var hobknobClient         = new HobknobClient(featureToggleCache, applicationName);

            if (cacheUpdateFailed == null)
            {
                throw new ArgumentNullException("cacheUpdateFailed", "Cached update handler is empty");
            }
            featureToggleCache.CacheUpdateFailed += cacheUpdateFailed;

            featureToggleCache.Initialize();

            return(hobknobClient);
        }
Ejemplo n.º 4
0
        public IHobknobClient Create(string host, int port, string applicationName, TimeSpan cacheUpdateInterval, EventHandler <CacheUpdateFailedArgs> cacheUpdateFailed)
        {
            var applicationFeaturesPath = $"http://{host}:{port}/api/applications/{applicationName}";

            var apiClient             = new ApiClient(new Uri(applicationFeaturesPath));
            var featureToggleProvider = new FeatureToggleProvider(apiClient);
            var featureToggleCache    = new FeatureToggleCache(featureToggleProvider, cacheUpdateInterval);
            var hobknobClient         = new HobknobClient(featureToggleCache, applicationName);

            if (cacheUpdateFailed == null)
            {
                throw new ArgumentNullException("cacheUpdateFailed", "Cached update handler is emtpy");
            }
            featureToggleCache.CacheUpdateFailed += cacheUpdateFailed;

            featureToggleCache.Initialize();

            return(hobknobClient);
        }