diff options
author | Dana Powers <dana.powers@gmail.com> | 2016-03-18 11:25:59 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2016-03-18 11:25:59 -0700 |
commit | 4f8d9fa9dcbffb961b546465e51326dafeb2e6c1 (patch) | |
tree | 2b1a69fa5971253116db3bba0c2b9409e8590f15 /docs/usage.rst | |
parent | 2f534c177fea1f70b6da691da323429bc5afda02 (diff) | |
download | kafka-python-4f8d9fa9dcbffb961b546465e51326dafeb2e6c1.tar.gz |
Add producer.flush() to usage docs
Diffstat (limited to 'docs/usage.rst')
-rw-r--r-- | docs/usage.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/usage.rst b/docs/usage.rst index d48cc0a..85fc44f 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -87,5 +87,12 @@ KafkaProducer producer = KafkaProducer(value_serializer=lambda m: json.dumps(m).encode('ascii')) producer.send('json-topic', {'key': 'value'}) + # produce asynchronously + for _ in range(100): + producer.send('my-topic', b'msg') + + # block until all async messages are sent + producer.flush() + # configure multiple retries producer = KafkaProducer(retries=5) |