internal HobknobClient(FeatureToggleCache featureToggleCache, string applicationName) { _featureToggleCache = featureToggleCache; _applicationName = applicationName; _featureToggleCache.CacheUpdated += RaiseCacheUpdatedEvent; _featureToggleCache.CacheUpdateFailed += RaiseCacheUpdateFailedEvent; }
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; }
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); }
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); }
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); }