/// <summary>
 /// Instance a new Stack Client plugin container.
 /// </summary>
 /// <param name="defaults">Defaults values for queries executed against this client.</param>
 /// <param name="handler">A request handler for this client.</param>
 /// <param name="logger">Event log message dispatcher.</param>
 /// <param name="cache">API Response cache store.</param>
 /// <param name="throttler">Request throttler.</param>
 public StackClientPlugins(IDefaults defaults, IRequestHandler handler, IEventLog logger, IResponseCache cache, IRequestThrottler throttler)
 {
     if (defaults == null)
     {
         throw new ArgumentNullException("defaults");
     }
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (cache == null)
     {
         throw new ArgumentNullException("cache");
     }
     if (throttler == null)
     {
         throw new ArgumentNullException("throttler");
     }
     Default = defaults;
     RequestHandler = handler;
     EventLog = logger;
     Cache = cache;
     Throttler = throttler;
 }
Exemple #2
0
 /// <summary>
 /// Instance a new Stack Client plugin container.
 /// </summary>
 /// <param name="defaults">Defaults values for queries executed against this client.</param>
 /// <param name="handler">A request handler for this client.</param>
 /// <param name="logger">Event log message dispatcher.</param>
 /// <param name="cache">API Response cache store.</param>
 /// <param name="throttler">Request throttler.</param>
 public StackClientPlugins(IDefaults defaults, IRequestHandler handler, IEventLog logger, IResponseCache cache, IRequestThrottler throttler)
 {
     if (defaults == null)
     {
         throw new ArgumentNullException("defaults");
     }
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     if (cache == null)
     {
         throw new ArgumentNullException("cache");
     }
     if (throttler == null)
     {
         throw new ArgumentNullException("throttler");
     }
     Default        = defaults;
     RequestHandler = handler;
     EventLog       = logger;
     Cache          = cache;
     Throttler      = throttler;
 }
 public SQSQueueProcessor(IEnumerable <ServiceConfiguration> serviceConfigurations,
                          AmazonSQS amazonSQS,
                          IRequestThrottler requestThrottler,
                          ICreateSQSQueueCommand createSQSQueueCommand,
                          ErrorditeConfiguration configuration)
 {
     _serviceConfiguration  = serviceConfigurations.First(c => c.IsActive);
     _amazonSQS             = amazonSQS;
     _requestThrottler      = requestThrottler;
     _createSQSQueueCommand = createSQSQueueCommand;
     _configuration         = configuration;
 }
Exemple #4
0
        public IRequestThrottler GetRequestThrottler(RateLimitConfigOptions config)
        {
            if (config is null)
            {
                throw new System.ArgumentNullException(nameof(config));
            }
            IRequestThrottler perSecThrottler = null;

            if (config.PerSecLimit > 0)
            {
                Console.WriteLine(">>>>>> initializing per sec throttler as well");
                perSecThrottler = new PerSecRequestThrottler(null, _redisCacheManager);
            }

            if (config.PerMinLimit > 0)
            {
                return(new PerMinRequestThrottler(perSecThrottler, _redisCacheManager));
            }

            return(null);
        }
 protected internal BaseRequestThrottler(IRequestThrottler requestThrottler)
 {
     _nextThrottler = requestThrottler;
 }
 public virtual void SetNextThrottler(IRequestThrottler nextThrottler)
 {
     _nextThrottler = nextThrottler;
 }
 public PerMinRequestThrottler(IRequestThrottler requestThrottler, IRedisCacheManager cacheManager) : base(requestThrottler)
 {
     _cacheManager = cacheManager;
 }
 public PerSecRequestThrottler(IRequestThrottler requestThrottler, IRedisCacheManager redisCacheManager) : base(requestThrottler)
 {
     _nextThrottler     = requestThrottler;
     _redisCacheManager = redisCacheManager;
 }