diff options
author | Mahendra M <mahendra.m@gmail.com> | 2013-06-20 15:03:29 +0530 |
---|---|---|
committer | Mahendra M <mahendra.m@gmail.com> | 2013-06-20 15:03:29 +0530 |
commit | 6158e29d27f8d752c799665ecc566fa5f547a986 (patch) | |
tree | 3b77789afaf5daa597b252a560d2458cfbbcb9b8 | |
parent | c2c555798ed915a5560b49a2c3c2be2c3ca5c2d4 (diff) | |
download | kafka-python-6158e29d27f8d752c799665ecc566fa5f547a986.tar.gz |
Update README with new options
-rw-r--r-- | README.md | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -39,6 +39,21 @@ producer.send_messages("this method", "is variadic") producer = SimpleProducer(kafka, "my-topic", async=True) producer.send_messages("async message") +# To wait for acknowledgements +# ACK_AFTER_LOCAL_WRITE : server will wait till the data is written to +# a local log before sending response +# ACK_AFTER_CLUSTER_COMMIT : server will block until the message is committed +# by all in sync replicas before sending a response +producer = SimpleProducer(kafka, "my-topic", async=False, + req_acks=SimpleProducer.ACK_AFTER_LOCAL_WRITE, + acks_timeout=2000) + +response = producer.send_messages("async message") + +if response: + print(response[0].error) + print(response[0].offset) + # To consume messages consumer = SimpleConsumer(kafka, "my-group", "my-topic") for message in consumer: |