diff options
Diffstat (limited to 'docs/index.rst')
-rw-r--r-- | docs/index.rst | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/index.rst b/docs/index.rst index d8f826a..eb8f429 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -74,9 +74,13 @@ client. See `KafkaProducer <apidoc/KafkaProducer.html>`_ 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 |