/// <summary> /// Construct a sink posting to the specified database. /// </summary> /// <param name="batchSizeLimit">The maximum number of events to include in a single batch.</param> /// <param name="period">The time to wait between checking for event batches.</param> protected PeriodicBatchingSink(int batchSizeLimit, TimeSpan period) { _batchSizeLimit = batchSizeLimit; _queue = new BoundedConcurrentQueue <LogEvent>(); _status = new BatchedConnectionStatus(period); _timer = new PortableTimer(cancel => OnTick()); }
PeriodicBatchingSink(PeriodicBatchingSinkOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (options.BatchSizeLimit <= 0) { throw new ArgumentOutOfRangeException(nameof(options), "The batch size limit must be greater than zero."); } if (options.Period <= TimeSpan.Zero) { throw new ArgumentOutOfRangeException(nameof(options), "The period must be greater than zero."); } _batchSizeLimit = options.BatchSizeLimit; _queue = new BoundedConcurrentQueue <LogEvent>(options.QueueLimit); _status = new BatchedConnectionStatus(options.Period); _eagerlyEmitFirstEvent = options.EagerlyEmitFirstEvent; _timer = new PortableTimer(cancel => OnTick()); }
/// <summary> /// Construct a sink posting to the specified database. /// </summary> /// <param name="batchSizeLimit">The maximum number of events to include in a single batch.</param> /// <param name="period">The time to wait between checking for event batches.</param> /// <param name="queueLimit">Maximum number of events in the queue.</param> protected PeriodicBatchingSink(int batchSizeLimit, TimeSpan period, int queueLimit) : this(batchSizeLimit, period) { _queue = new BoundedConcurrentQueue <LogEvent>(queueLimit); }