Пример #1
0
        public int Parse(byte[] data, int dataOffset)
        {
            int bufferOffset = dataOffset;
            Brokers = new List<Broker>();

            bufferOffset = BufferReader.Read(data, bufferOffset, out correlationId);
            int brokerCount;
            bufferOffset = BufferReader.Read(data, bufferOffset, out brokerCount);
            for (var i = 0; i < brokerCount; i++)
            {
                Broker broker = new Broker();
                bufferOffset = broker.Parse(data, bufferOffset);
                Brokers.Add(broker);
            }

            int topicCount;
            bufferOffset = BufferReader.Read(data, bufferOffset, out topicCount);
            for (var i = 0; i < topicCount; i++)
            {
                TopicMetaData topicMetaData = new TopicMetaData();
                bufferOffset = topicMetaData.Parse(data, bufferOffset);
                topicMetaDatas.Add(topicMetaData.TopicName,topicMetaData);
            }

            return bufferOffset;
        }
Пример #2
0
        public int Parse(byte[] data, int dataOffset)
        {
            int bufferOffset = dataOffset;

            Brokers = new List <Broker>();

            bufferOffset = BufferReader.Read(data, bufferOffset, out correlationId);
            int brokerCount;

            bufferOffset = BufferReader.Read(data, bufferOffset, out brokerCount);
            for (var i = 0; i < brokerCount; i++)
            {
                Broker broker = new Broker();
                bufferOffset = broker.Parse(data, bufferOffset);
                Brokers.Add(broker);
            }

            int topicCount;

            bufferOffset = BufferReader.Read(data, bufferOffset, out topicCount);
            for (var i = 0; i < topicCount; i++)
            {
                TopicMetaData topicMetaData = new TopicMetaData();
                bufferOffset = topicMetaData.Parse(data, bufferOffset);
                topicMetaDatas.Add(topicMetaData.TopicName, topicMetaData);
            }

            return(bufferOffset);
        }
Пример #3
0
        public List <int> Partitions(string topicName)
        {
            List <int> partitions = new List <int>();

            if (!topicMetaDatas.ContainsKey(topicName))
            {
                return(partitions);
            }

            TopicMetaData topicMetaData = topicMetaDatas[topicName];

            return(topicMetaData.Partitions());
        }