/// <summary> /// Creates a new client to connect to LaunchDarkly with a custom configuration, and a custom /// implementation of the analytics event processor. This constructor should only be used if you are /// overriding the default event-sending behavior. /// </summary> /// <param name="config">a client configuration object</param> /// <param name="eventStore">an event processor</param> public LdClient(Configuration config, IStoreEvents eventStore) { Log.InfoFormat("Starting LaunchDarkly Client {0}", Configuration.Version); _configuration = config; _eventStore = eventStore; _featureStore = _configuration.FeatureStore; if (_configuration.Offline) { Log.Info("Starting Launchdarkly client in offline mode."); return; } var featureRequestor = new FeatureRequestor(config); if (_configuration.IsStreamingEnabled) { _updateProcessor = new StreamProcessor(config, featureRequestor, _featureStore); } else { Log.Warn("You should only disable the streaming API if instructed to do so by LaunchDarkly support"); _updateProcessor = new PollingProcessor(config, featureRequestor, _featureStore); } var initTask = _updateProcessor.Start(); Log.InfoFormat("Waiting up to {0} milliseconds for LaunchDarkly client to start..", _configuration.StartWaitTime.TotalMilliseconds); var unused = initTask.Wait(_configuration.StartWaitTime); }
IUpdateProcessor IUpdateProcessorFactory.CreateUpdateProcessor(Configuration config, IFeatureStore featureStore) { if (config.Offline) { Log.Info("Starting Launchdarkly client in offline mode."); return(new NullUpdateProcessor()); } else if (config.UseLdd) { Log.Info("Starting LaunchDarkly in LDD mode. Skipping direct feature retrieval."); return(new NullUpdateProcessor()); } else { FeatureRequestor requestor = new FeatureRequestor(config); if (config.IsStreamingEnabled) { return(new StreamProcessor(config, requestor, featureStore, null)); } else { Log.Warn("You should only disable the streaming API if instructed to do so by LaunchDarkly support"); return(new PollingProcessor(config, requestor, featureStore)); } } }
internal PollingProcessor(Configuration config, FeatureRequestor featureRequestor, IFeatureStore featureStore) { _config = config; _featureRequestor = featureRequestor; _featureStore = featureStore; _initTask = new TaskCompletionSource <bool>(); }
public LdClient(Configuration config, IStoreEvents eventStore) { Logger.LogInformation("Starting LaunchDarkly Client " + Configuration.Version); _configuration = config; _eventStore = eventStore; _featureStore = config.FeatureStore; if (_configuration.Offline) { Logger.LogInformation("Starting Launchdarkly client in offline mode."); return; } var featureRequestor = new FeatureRequestor(config); _updateProcessor = new PollingProcessor(config, featureRequestor, _featureStore); var initTask = _updateProcessor.Start(); Logger.LogInformation("Waiting up to " + _configuration.StartWaitTime.TotalMilliseconds + " milliseconds for LaunchDarkly client to start.."); var unused = initTask.Task.Wait(_configuration.StartWaitTime); }