Example #1
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     writer.Write((short)ApiKey);
     writer.Write(ApiVersion);
     writer.Write(CorrelationId);
     return 2 + 2 + 4 + writer.WriteAndReturnLength(ClientId);
 }
Example #2
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     var baseBytes = base.WriteToWire(writer);
     writer.Write(RequiredAcks);
     writer.Write(Timeout);
     var productinsBytes = writer.Write(TopicProductions);
     return baseBytes + 2 + 4 + productinsBytes;
 }
Example #3
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     var baseBytes = base.WriteToWire(writer);
     writer.Write(ReplicaId);
     writer.Write(MaxWaitTime);
     writer.Write(MinBytes);
     return baseBytes + 4 + 4 + 4 + writer.Write(Topics);
 }
Example #4
0
 public byte[] BytesForWire()
 {
     using (var ms = new MemoryStream())
     using (var w = new KafkaWireWriter(ms))
     {
         w.Write(0);
         var bytesWritten = WriteToWire(w);
         w.Seek(0, SeekOrigin.Begin);
         w.Write(bytesWritten);
         return ms.ToArray();
     }
 }
Example #5
0
        public Message(int crc, byte magicByte, byte attributes, byte[] key, byte[] value)
        {
            Crc = crc;
            MagicByte = magicByte;
            Attributes = attributes;
            Key = key;
            Value = value;

            _MessageData = new byte[4 + 1 + 1 + 4 + (key == null ? 0 : key.Length) + 4 + (value == null ? 0 : value.Length)];
            using (var ms = new MemoryStream(_MessageData))
            using (var w = new KafkaWireWriter(ms))
            {
                w.Write(Crc);
                w.Write(MagicByte);
                w.Write(Attributes);
                w.Write(Key);
                w.Write(Value);
            }
        }
Example #6
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     writer.Write(Partition);
     writer.Write(MessageSetSize);
     return 4 + 4 + writer.WriteWithoutSize(MessageSet);
 }
Example #7
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     return writer.WriteAndReturnLength(Topic) + writer.Write(Partitions);
 }
Example #8
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     writer.Write(Partition);
     writer.Write(FetchOffset);
     writer.Write(MaxBytes);
     return 4 + 8 + 4;
 }
Example #9
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     var baseBytes = base.WriteToWire(writer);
     return baseBytes + writer.Write(TopicNames);
 }
Example #10
0
 public abstract int WriteToWire(KafkaWireWriter writer);
Example #11
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     writer.WriteWithoutSize(_MessageData);
     return _MessageData.Length;
 }