public static BrokerInfoResponse ReadFromStream(BinaryStream stream)
{
var request = new BrokerInfoResponse();
request.HostName = stream.Reader.ReadString();
request.BrokerId = stream.Reader.ReadInt32();
request.PullPort = stream.Reader.ReadInt32();
request.NumberOfPartitions = stream.Reader.ReadInt32();
// Reading dictionary of <String, Int32>
var length = stream.Reader.ReadInt32();
for (int i = 0; i < length; i++)
{
var topic = stream.Reader.ReadString();
var partitionsNumber = stream.Reader.ReadInt32();
request.NumberOfPartitionsPerTopic.Add(topic, partitionsNumber);
}
return request;
}