예제 #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);
 }
예제 #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;
 }
예제 #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);
 }
예제 #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();
     }
 }
예제 #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);
            }
        }
예제 #6
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     writer.Write(Partition);
     writer.Write(MessageSetSize);
     return 4 + 4 + writer.WriteWithoutSize(MessageSet);
 }
예제 #7
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     return writer.WriteAndReturnLength(Topic) + writer.Write(Partitions);
 }
예제 #8
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     writer.Write(Partition);
     writer.Write(FetchOffset);
     writer.Write(MaxBytes);
     return 4 + 8 + 4;
 }
예제 #9
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     var baseBytes = base.WriteToWire(writer);
     return baseBytes + writer.Write(TopicNames);
 }
예제 #10
0
 public abstract int WriteToWire(KafkaWireWriter writer);
예제 #11
0
 public override int WriteToWire(KafkaWireWriter writer)
 {
     writer.WriteWithoutSize(_MessageData);
     return _MessageData.Length;
 }