Exemple #1
0
        public async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                cancellationToken.ThrowIfCancellationRequested();
            }

            if (!string.IsNullOrEmpty(Domain))
            {
                using (var client = new HttpClient())
                {
                    var baseAddress = new Uri(Domain);
                    client.BaseAddress = baseAddress;
                    var response = await client.GetAsync(baseAddress.AddPath("/api/Calculate/GeneratePaymentPlan"));

                    if (response.IsSuccessStatusCode)
                    {
                        await LogProvider.LogAsync(Schedule, LogType.Schedule);
                    }
                    else
                    {
                        await LogProvider.LogAsync($"[{(int)response.StatusCode} {response.StatusCode}] {Schedule}", LogType.Error);
                    }
                }
            }
        }
Exemple #2
0
        internal StreamProcessor(
            LdClientContext context,
            IDataSourceUpdates dataSourceUpdates,
            Uri baseUri,
            TimeSpan initialReconnectDelay,
            EventSourceCreator eventSourceCreator
            )
        {
            _log = context.Basic.Logger.SubLogger(LogNames.DataSourceSubLog);
            _log.Info("Connecting to LaunchDarkly stream");

            _dataSourceUpdates     = dataSourceUpdates;
            _httpConfig            = context.Http;
            _initialReconnectDelay = initialReconnectDelay;
            _diagnosticStore       = context.DiagnosticStore;
            _initTask  = new TaskCompletionSource <bool>();
            _streamUri = baseUri.AddPath(StandardEndpoints.StreamingRequestPath);

            _storeStatusMonitoringEnabled = _dataSourceUpdates.DataStoreStatusProvider.StatusMonitoringEnabled;
            if (_storeStatusMonitoringEnabled)
            {
                _dataSourceUpdates.DataStoreStatusProvider.StatusChanged += OnDataStoreStatusChanged;
            }

            _es = (eventSourceCreator ?? CreateEventSource)(_streamUri, _httpConfig);
            _es.MessageReceived += OnMessage;
            _es.Error           += OnError;
            _es.Opened          += OnOpen;
        }
Exemple #3
0
 private static void DoCommit(Uri commitUri, ExecutionConfiguration executionConfiguration, ISerializer serializer, NameValueCollection customHeaders = null)
 {
     Request.With(executionConfiguration, customHeaders)
     .Post(commitUri.AddPath("commit"))
     .WithJsonContent(serializer.Serialize(new CypherStatementList()))
     .WithExpectedStatusCodes(HttpStatusCode.OK)
     .Execute();
 }
 internal FeatureRequestor(LdClientContext context, Uri baseUri)
 {
     _httpProperties = context.Http.HttpProperties;
     _httpClient     = context.Http.NewHttpClient();
     _connectTimeout = context.Http.ConnectTimeout;
     _allUri         = baseUri.AddPath(StandardEndpoints.PollingRequestPath);
     _log            = context.Basic.Logger.SubLogger(LogNames.DataSourceSubLog);
 }
        public async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                cancellationToken.ThrowIfCancellationRequested();
            }

            if (!string.IsNullOrEmpty(Domain))
            {
                using (var client = new System.Net.Http.HttpClient())
                {
                    var baseAddress = new Uri(Domain);
                    client.BaseAddress = baseAddress;
                    var response = await client.GetAsync(baseAddress.AddPath("/api/Token"));
                    await LogAsync(response.IsSuccessStatusCode, $"[{(int)response.StatusCode} {response.StatusCode}]  {Schedule}");
                }
            }
        }
Exemple #6
0
        private Uri MakeRequestUriWithPath(string path)
        {
            var uri = _baseUri.AddPath(path);

            return(_withReasons ? uri.AddQuery("withReasons=true") : uri);
        }
 private Uri AddPath(Uri startUri, RelationshipReference relationship)
 {
     return(startUri.AddPath("relationship").AddPath(relationship.Id.ToString()));
 }
 private Uri AddPath(Uri startUri, NodeReference node)
 {
     return(startUri.AddPath("node").AddPath(node.Id.ToString()));
 }