Exemplo n.º 1
0
 private static byte[] EncodeRequest(IRequestContext context, CreateTopicsRequest request)
 {
     using (var writer = EncodeHeader(context, request)) {
         writer.Write(request.Topics.Count);
         foreach (var topic in request.Topics)
         {
             writer.Write(topic.TopicName)
             .Write(topic.NumberOfPartitions)
             .Write(topic.ReplicationFactor)
             .Write(topic.ReplicaAssignments.Count);
             foreach (var assignment in topic.ReplicaAssignments)
             {
                 writer.Write(assignment.PartitionId)
                 .Write(assignment.Replicas);
             }
             writer.Write(topic.Configs.Count);
             foreach (var config in topic.Configs)
             {
                 writer.Write(config.Key)
                 .Write(config.Value);
             }
         }
         writer.Write((int)request.Timeout.TotalMilliseconds);
         return(writer.ToBytes());
     }
 }
Exemplo n.º 2
0
 public bool Equals(CreateTopicsRequest other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(create_topic_requests.HasEqualElementsInOrder(other.create_topic_requests) &&
            timeout.Equals(other.timeout));
 }