KafkaProducer

The kafka-python class that buffers records, batches them and sends them to Kafka in the background.

In more detail

Calling send returns a future straight away; the record is delivered by a background thread. Its settings, such as acks, linger_ms, batch_size and enable_idempotence, control durability, throughput and duplicates. Call flush or close before the program exits so buffered records are not lost.

Example

producer.send('events', key=b'k1', value=b'v1').get(timeout=10)

Related terms

Taught in

References

Certification courses