예제 #1
0
        /// <summary>
        /// Construct a sink posting to the specified database.
        /// </summary>
        /// <param name="options">Options for configuring how the sink behaves, may NOT be null.</param>
        public KinesisSink(KinesisSinkOptions options) :
            base(options.BatchPostingLimit, options.Period)
        {
            _state = KinesisSinkState.Create(options);

            _minimumAcceptedLevel = _state.Options.MinimumLogEventLevel;
        }
예제 #2
0
        public static KinesisSinkState Create(KinesisSinkOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            var state = new KinesisSinkState(options);

            return(state);
        }
        public DurableKinesisSink(KinesisSinkOptions options)
        {
            var state = KinesisSinkState.Create(options);

            if (string.IsNullOrWhiteSpace(options.BufferBaseFilename))
            {
                throw new ArgumentException("Cannot create the durable Amazon Kinesis sink without a buffer base file name.");
            }

            _sink = new RollingFileSink(
                options.BufferBaseFilename + "-{Date}.json",
                state.DurableFormatter,
                options.BufferFileSizeLimitBytes,
                null);

            _shipper = new HttpLogShipper(state);

            if (options.OnLogSendError != null)
            {
                _shipper.LogSendError += options.OnLogSendError;
            }
        }
예제 #4
0
        private KinesisSinkState(KinesisSinkOptions options)
        {
            if (string.IsNullOrWhiteSpace(options.StreamName))
            {
                throw new ArgumentException("options.StreamName");
            }

            _client  = options.KinesisClient;
            _options = options;

            _formatter = options.CustomDurableFormatter ?? new CustomJsonFormatter(
                omitEnclosingObject: false,
                closingDelimiter: string.Empty,
                renderMessage: true,
                formatProvider: options.FormatProvider
                );

            _durableFormatter = options.CustomDurableFormatter ?? new CustomJsonFormatter(
                omitEnclosingObject: false,
                closingDelimiter: Environment.NewLine,
                renderMessage: true,
                formatProvider: options.FormatProvider
                );
        }