Пример #1
0
class HeadStruct(Struct):
    api_key = ShortField()
    api_version = ShortField(default=0)
    correlation_id = IntField()
    client_id_length = ShortField(default=len(KafkaProtocol.CLIENT_ID))
    client_id = CharField(default=KafkaProtocol.CLIENT_ID,
                          length='client_id_length')
Пример #2
0
class PartitionStruct(Struct):
    error = ShortField()
    partition = IntField()
    leader = IntField()
    replicas_number = IntField()
    replicas = IntField(repeat='replicas_number')
    isr_number = IntField()
    isr = IntField(repeat='isr_number')
Пример #3
0
class TopicStruct(Struct):
    error = ShortField()
    topic_name_length = ShortField()
    topic_name = CharField(length='topic_name_length')
    partitions_number = IntField()
    partitions = PartitionStruct(repeat='partitions_number')
Пример #4
0
class BrokerStruct(Struct):
    node_id = IntField()
    host_char_len = ShortField()
    host = CharField(length='host_char_len')
    port = IntField()
Пример #5
0
class MetaTopicStruct(Struct):
    topic_name_length = ShortField()
    topic_name = CharField(length='topic_name_length')
Пример #6
0
class ResponseTopicStruct(Struct):
    topic_name_length = ShortField()
    topic_name = CharField(length='topic_name_length')
    partitions_number = IntField()
    partitions = ResponsePartitionStruct(repeat='partitions_number')
Пример #7
0
class ResponsePartitionStruct(Struct):
    partition = IntField()
    error = ShortField()
    offset = LongLongField()
Пример #8
0
class ProduceStruct(Struct):
    head = HeadStruct(KafkaProtocol.PRODUCE_KEY, 0)
    acks = ShortField(default=1)
    timeout = IntField(default=1000)
    payloads_number = IntField()
    payloads = ProducePayloadStruct(repeat='payloads_number')
Пример #9
0
class ProducePayloadStruct(Struct):
    topic_name_length = ShortField()
    topic_name = CharField(length='topic_name_length')
    topic_payloads_number = IntField()
    topic_payloads = MessageSetStruct(repeat='topic_payloads_number')