Ejemplo n.º 1
0
        public SyncManager(bool streamingEnabled,
                           ISynchronizer synchronizer,
                           IPushManager pushManager,
                           ISSEHandler sseHandler,
                           INotificationManagerKeeper notificationManagerKeeper,
                           ITelemetryRuntimeProducer telemetryRuntimeProducer,
                           IStatusManager statusManager,
                           ITasksManager tasksManager,
                           IWrapperAdapter wrapperAdapter,
                           ITelemetrySyncTask telemetrySyncTask,
                           ISplitLogger log = null)
        {
            _streamingEnabled = streamingEnabled;
            _synchronizer     = synchronizer;
            _pushManager      = pushManager;
            _sseHandler       = sseHandler;
            _log = log ?? WrapperAdapter.GetLogger(typeof(Synchronizer));
            _telemetryRuntimeProducer = telemetryRuntimeProducer;
            _statusManager            = statusManager;
            _tasksManager             = tasksManager;
            _wrapperAdapter           = wrapperAdapter;
            _telemetrySyncTask        = telemetrySyncTask;

            _sseHandler.ActionEvent += OnProcessFeedbackSSE;
            notificationManagerKeeper.ActionEvent += OnProcessFeedbackSSE;

            _shutdownCancellationTokenSource = new CancellationTokenSource();
        }
Ejemplo n.º 2
0
        public SdkApiClient(string apiKey,
                            Dictionary <string, string> headers,
                            string baseUrl,
                            long connectionTimeOut,
                            long readTimeout,
                            ITelemetryRuntimeProducer telemetryRuntimeProducer)
        {
#if NET40 || NET45 || NET461
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
#endif
            _telemetryRuntimeProducer = telemetryRuntimeProducer;
            var handler = new HttpClientHandler()
            {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            };

            _httpClient = new HttpClient(handler)
            {
                BaseAddress = new Uri(baseUrl),
                //TODO: find a way to store it in sepparated parameters
                Timeout = TimeSpan.FromMilliseconds(connectionTimeOut + readTimeout)
            };

            _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(Constants.Http.Bearer, apiKey);
            _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(Constants.Http.MediaTypeJson));

            foreach (var header in headers)
            {
                _httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
            }
        }
Ejemplo n.º 3
0
 public SplitSdkApiClient(string apiKey,
                          Dictionary <string, string> headers,
                          string baseUrl,
                          long connectionTimeOut,
                          long readTimeout,
                          ITelemetryRuntimeProducer telemetryRuntimeProducer) : base(apiKey, headers, baseUrl, connectionTimeOut, readTimeout, telemetryRuntimeProducer)
 {
 }
Ejemplo n.º 4
0
        public NotificationManagerKeeper(ITelemetryRuntimeProducer telemetryRuntimeProducer,
                                         ISplitLogger log = null)
        {
            _telemetryRuntimeProducer = telemetryRuntimeProducer;
            _log = log ?? WrapperAdapter.GetLogger(typeof(NotificationManagerKeeper));

            _publisherAvailable = true;
        }
Ejemplo n.º 5
0
        private void BuildTelemetryStorage()
        {
            var telemetryStorage = new InMemoryTelemetryStorage();

            _telemetryStorageConsumer    = telemetryStorage;
            _telemetryEvaluationProducer = telemetryStorage;
            _telemetryInitProducer       = telemetryStorage;
            _telemetryRuntimeProducer    = telemetryStorage;
        }
Ejemplo n.º 6
0
 public TelemetryAPI(ISplitioHttpClient splitioHttpClient,
                     string telemetryURL,
                     ITelemetryRuntimeProducer telemetryRuntimeProducer,
                     ISplitLogger log = null)
 {
     _splitioHttpClient        = splitioHttpClient;
     _telemetryURL             = telemetryURL;
     _telemetryRuntimeProducer = telemetryRuntimeProducer;
     _log = log ?? WrapperAdapter.GetLogger(typeof(TelemetryAPI));
 }
Ejemplo n.º 7
0
 public AuthApiClient(string url,
                      string apiKey,
                      ISplitioHttpClient splitioHttpClient,
                      ITelemetryRuntimeProducer telemetryRuntimeProducer,
                      ISplitLogger log = null)
 {
     _url = url;
     _splitioHttpClient        = splitioHttpClient;
     _telemetryRuntimeProducer = telemetryRuntimeProducer;
     _log = log ?? WrapperAdapter.GetLogger(typeof(AuthApiClient));
 }
Ejemplo n.º 8
0
 public ImpressionsSdkApiClient(string apiKey,
                                Dictionary <string, string> headers,
                                string baseUrl,
                                long connectionTimeOut,
                                long readTimeout,
                                ITelemetryRuntimeProducer telemetryRuntimeProducer,
                                IWrapperAdapter wrapperAdapter,
                                int maxBulkSize) : base(apiKey, headers, baseUrl, connectionTimeOut, readTimeout, telemetryRuntimeProducer)
 {
     _wrapperAdapter = wrapperAdapter;
     _maxBulkSize    = maxBulkSize;
 }
Ejemplo n.º 9
0
 public PushManager(ISSEHandler sseHandler,
                    IAuthApiClient authApiClient,
                    IWrapperAdapter wrapperAdapter,
                    ITelemetryRuntimeProducer telemetryRuntimeProducer,
                    IBackOff backOff,
                    ISplitLogger log = null)
 {
     _sseHandler               = sseHandler;
     _authApiClient            = authApiClient;
     _log                      = log ?? WrapperAdapter.GetLogger(typeof(PushManager));
     _wrapperAdapter           = wrapperAdapter;
     _backOff                  = backOff;
     _telemetryRuntimeProducer = telemetryRuntimeProducer;
 }
Ejemplo n.º 10
0
        public EventSourceClient(INotificationParser notificationParser,
                                 IWrapperAdapter wrapperAdapter,
                                 ISplitioHttpClient splitHttpClient,
                                 ITelemetryRuntimeProducer telemetryRuntimeProducer,
                                 ITasksManager tasksManager,
                                 ISplitLogger log = null)
        {
            _notificationParser = notificationParser;
            _wrapperAdapter     = wrapperAdapter;
            _splitHttpClient    = splitHttpClient;
            _log = log ?? WrapperAdapter.GetLogger(typeof(EventSourceClient));
            _telemetryRuntimeProducer = telemetryRuntimeProducer;
            _tasksManager             = tasksManager;

            _firstEvent = true;
        }
Ejemplo n.º 11
0
 public ImpressionsManager(IImpressionsLog impressionsLog,
                           IImpressionListener customerImpressionListener,
                           IImpressionsCounter impressionsCounter,
                           bool addPreviousTime,
                           ImpressionsMode impressionsMode,
                           ITelemetryRuntimeProducer telemetryRuntimeProducer,
                           ITasksManager taskManager,
                           IImpressionsObserver impressionsObserver = null)
 {
     _impressionsLog             = impressionsLog;
     _customerImpressionListener = customerImpressionListener;
     _impressionsCounter         = impressionsCounter;
     _addPreviousTime            = addPreviousTime;
     _optimized                = impressionsMode == ImpressionsMode.Optimized && addPreviousTime;
     _impressionsObserver      = impressionsObserver;
     _telemetryRuntimeProducer = telemetryRuntimeProducer;
     _taskManager              = taskManager;
 }
Ejemplo n.º 12
0
        public EventsLog(IEventSdkApiClient apiClient,
                         int firstPushWindow,
                         int interval,
                         ISimpleCache <WrappedEvent> eventsCache,
                         ITelemetryRuntimeProducer telemetryRuntimeProducer,
                         ITasksManager tasksManager,
                         int maximumNumberOfKeysToCache = -1)
        {
            _cancellationTokenSource = new CancellationTokenSource();

            _wrappedEventsCache       = (eventsCache as ISimpleProducerCache <WrappedEvent>) ?? new InMemorySimpleCache <WrappedEvent>(new BlockingQueue <WrappedEvent>(maximumNumberOfKeysToCache));
            _apiClient                = apiClient;
            _interval                 = interval;
            _firstPushWindow          = firstPushWindow;
            _telemetryRuntimeProducer = telemetryRuntimeProducer;
            _tasksManager             = tasksManager;

            _wrapperAdapter = new WrapperAdapter();
        }