summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-03-18 11:25:59 -0700
committerDana Powers <dana.powers@gmail.com>2016-03-18 11:25:59 -0700
commit4f8d9fa9dcbffb961b546465e51326dafeb2e6c1 (patch)
tree2b1a69fa5971253116db3bba0c2b9409e8590f15 /README.rst
parent2f534c177fea1f70b6da691da323429bc5afda02 (diff)
downloadkafka-python-4f8d9fa9dcbffb961b546465e51326dafeb2e6c1.tar.gz
Add producer.flush() to usage docs
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst8
1 files changed, 6 insertions, 2 deletions
diff --git a/README.rst b/README.rst
index 782aba0..8b40519 100644
--- a/README.rst
+++ b/README.rst
@@ -76,9 +76,13 @@ for more details.
>>> from kafka import KafkaProducer
>>> producer = KafkaProducer(bootstrap_servers='localhost:1234')
->>> producer.send('foobar', b'some_message_bytes')
+>>> for _ in range(100):
+... producer.send('foobar', b'some_message_bytes')
->>> # Blocking send
+>>> # Block until all pending messages are sent
+>>> producer.flush()
+
+>>> # Block until a single message is sent (or timeout)
>>> producer.send('foobar', b'another_message').get(timeout=60)
>>> # Use a key for hashed-partitioning