Esempio n. 1
0
        public RedisOutput(TimberWinR.Manager manager, Parser.RedisOutputParameters parameters, CancellationToken cancelToken)
            : base(cancelToken, "Redis")
        {
            _redisDepth = 0;
            _batchCount = parameters.BatchCount;
            _maxBatchCount = parameters.MaxBatchCount;
            // Make sure maxBatchCount is larger than batchCount
            if (_maxBatchCount <= _batchCount)
                _maxBatchCount = _batchCount * 10;

            _manager = manager;
            _redisHostIndex = 0;
            _redisHosts = parameters.Host;
            _jsonQueue = new List<string>();
            _port = parameters.Port;
            _timeout = parameters.Timeout;
            _logstashIndexName = parameters.Index;
            _interval = parameters.Interval;
            _numThreads = parameters.NumThreads;
            _errorCount = 0;
            _lastErrorTimeUTC = null;
            _maxQueueSize = parameters.MaxQueueSize;
            _queueOverflowDiscardOldest = parameters.QueueOverflowDiscardOldest;
            _batchCounter = new BatchCounter(_batchCount, _maxBatchCount);
            _currentBatchCount = _batchCount;

            for (int i = 0; i < parameters.NumThreads; i++)
            {
                var redisThread = new Task(RedisSender, cancelToken);
                redisThread.Start();
            }
        }
Esempio n. 2
0
        public RedisOutput(TimberWinR.Manager manager, Parser.RedisOutputParameters parameters, CancellationToken cancelToken)
            : base(cancelToken, "Redis")
        {
            _redisDepth    = 0;
            _batchCount    = parameters.BatchCount;
            _maxBatchCount = parameters.MaxBatchCount;
            // Make sure maxBatchCount is larger than batchCount
            if (_maxBatchCount <= _batchCount)
            {
                _maxBatchCount = _batchCount * 10;
            }

            _manager                    = manager;
            _redisHostIndex             = 0;
            _redisHosts                 = parameters.Host;
            _jsonQueue                  = new List <string>();
            _port                       = parameters.Port;
            _timeout                    = parameters.Timeout;
            _logstashIndexName          = parameters.Index;
            _interval                   = parameters.Interval;
            _numThreads                 = parameters.NumThreads;
            _errorCount                 = 0;
            _lastErrorTimeUTC           = null;
            _maxQueueSize               = parameters.MaxQueueSize;
            _queueOverflowDiscardOldest = parameters.QueueOverflowDiscardOldest;
            _batchCounter               = new BatchCounter(_batchCount, _maxBatchCount);
            _currentBatchCount          = _batchCount;

            for (int i = 0; i < parameters.NumThreads; i++)
            {
                var redisThread = new Task(RedisSender, cancelToken);
                redisThread.Start();
            }
        }