public void SaveTo(KafkaWriter writer)
        {
            //writer.Write(Version);
            //writer.Write(Topics);
            //writer.Write(UserData);

            using (var stream = new MemoryStream(4096)) {
                var writer2 = new KafkaWriter(stream);
                writer2.Write(Version);
                writer2.Write(Topics);
                writer2.Write(UserData);
                writer2.Dispose();

                stream.Seek(0L, SeekOrigin.Begin);
                var protocolMetadata = stream.ToArray();
                writer.Write(protocolMetadata);
            }
        }
Exemple #2
0
        public void SaveTo(KafkaWriter writer)
        {
            //writer.Write(Version);
            //writer.Write(PartitionAssignments);
            //writer.Write(UserData);

            using (var stream = new MemoryStream(4096)) {
                var writer2 = new KafkaWriter(stream);
                writer2.Write(Version);
                writer2.Write(PartitionAssignments);
                writer2.Write(UserData);
                writer2.Dispose();

                stream.Seek(0L, SeekOrigin.Begin);
                var memberAssignment = stream.ToArray();
                writer.Write(memberAssignment);
            }
        }
Exemple #3
0
        public override void SaveTo(KafkaWriter writer)
        {
            using (var stream = new MemoryStream(4096)) {
                var writer2 = new KafkaWriter(stream);
                foreach (var item in Items)
                {
                    item.SaveTo(writer2);
                }
                var messageBuffer           = stream.ToArray();
                var compressedMessageBuffer = Compress.GZip.Compress(messageBuffer, 0, messageBuffer.Length);

                Items = new[] {
                    new MessageSetDetail {
                        Message = new MessageSetItem {
                            Attributes = MessageCodec.Gzip,
                            Value      = compressedMessageBuffer,
                        }
                    }
                };
                writer2.Dispose();
                base.SaveTo(writer);
            }
        }