/// <summary>
        /// Emit a batch of log events, running to completion asynchronously.
        /// </summary>
        /// <param name="events">The events to be logged to Kinesis</param>
        protected override void EmitBatch(IEnumerable<LogEvent> events)
        {
            var request = new PutRecordsRequest
            {
                StreamName = _state.Options.StreamName
            };

            foreach (var logEvent in events)
            {
                var json = new StringWriter();
                _state.Formatter.Format(logEvent, json);

                var bytes = Encoding.UTF8.GetBytes(json.ToString());

                var entry = new PutRecordsRequestEntry
                {
                    PartitionKey = Guid.NewGuid().ToString(),
                    Data = new MemoryStream(bytes),
                };

                request.Records.Add(entry);
            }

            _state.KinesisClient.PutRecords(request);
        }
        public static KM.PutRecordsRequestEntry ReadPutRecordsRequestEntry(this BinaryReader reader)
        {
            var entry = new KM.PutRecordsRequestEntry();

            entry.PartitionKey    = reader.ReadNullableString();
            entry.ExplicitHashKey = reader.ReadNullableString();
            entry.Data            = reader.ReadMemoryStream();
            return(entry);
        }
 public static void WritePutRecordsRequestEntry(this BinaryWriter writer, KM.PutRecordsRequestEntry entry)
 {
     writer.WriteNullableString(entry.PartitionKey);
     writer.WriteNullableString(entry.ExplicitHashKey);
     writer.WriteMemoryStream(entry.Data);
 }