Ejemplo n.º 1
0
        private static IKafkaReader ReadHeader(ArraySegment <byte> data, out ApiKey apiKey, out IRequestContext context)
        {
            var reader = new KafkaReader(data);

            try {
                apiKey = (ApiKey)reader.ReadInt16();
                var version       = reader.ReadInt16();
                var correlationId = reader.ReadInt32();
                var clientId      = reader.ReadString();

                context = new RequestContext(correlationId, version, clientId);
            } catch {
                apiKey  = 0;
                context = null;
                reader.Dispose();
                reader = null;
            }
            return(reader);
        }