RecordMetadata
The object a producer's future returns once the broker accepts a record, holding the topic, partition and offset it was written to.
In more detail
Reading meta.partition and meta.offset is the simplest way to see where a record landed. With acks set to zero the broker sends nothing back, so kafka-python reports the offset as -1.
Example
print(f'partition {meta.partition} offset {meta.offset}')Related terms
- Future — An object that stands for a result that is not ready yet, which you can wait on later to get the value or the error.
- offset — The permanent position number of a record inside its partition, starting at zero and increasing by one for each record.
- partition — One of several independent ordered logs a message stream is split into, with each message routed to one partition by its key.
- acks — The producer setting that decides how many brokers must confirm a record before the send counts as successful: 0, 1 or all.
Taught in
- A Producer In Python — Apache Kafka & Event Streaming
- Keys And Ordering Per Partition — Apache Kafka & Event Streaming