Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventSource" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <exception cref="ArgumentNullException">client
        /// or
        /// configuration</exception>
        public EventSource(Configuration configuration)
        {
            _readyState = ReadyState.Raw;

            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));

            _logger = _configuration.Logger ?? LogManager.GetLogger(typeof(EventSource));

            _retryDelay = _configuration.DelayRetryDuration;

            _backOff = new ExponentialBackoffWithDecorrelation(_retryDelay,
                                                               Configuration.MaximumRetryDuration);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventSource" /> class.
        /// </summary>
        /// <param name="configuration">the configuration</param>
        public EventSource(Configuration configuration)
        {
            _readyState = ReadyState.Raw;

            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));

            _logger = _configuration.Logger;

            _retryDelay = _configuration.InitialRetryDelay;

            _backOff = new ExponentialBackoffWithDecorrelation(_retryDelay, _configuration.MaxRetryDelay);

            _httpClient = _configuration.HttpClient ?? CreateHttpClient();
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventSource" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <exception cref="ArgumentNullException">client
        /// or
        /// configuration</exception>
        public EventSource(Configuration configuration)
        {
            ReadyState = ReadyState.Raw;

            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));

            _logger = _configuration.Logger ?? new LoggerFactory().CreateLogger <EventSource>();

            _pendingRequest = new CancellationTokenSource();

            _retryDelay = _configuration.DelayRetryDuration;

            _backOff = new ExponentialBackoffWithDecorrelation(_retryDelay,
                                                               _configuration.MaximumDelayRetryDuration);
        }