summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMahendra M <mahendra.m@gmail.com>2013-06-26 13:54:12 +0530
committerMahendra M <mahendra.m@gmail.com>2013-06-26 13:54:12 +0530
commit0c0e163894c6fe4fdc4d3fe1beec2414d367bfbd (patch)
tree2fc47309508a2a5fdc82f7a09c6bbbfbff5cb2c8 /README.md
parentefb1dabd1343de3be3371720244d9c1300951bfd (diff)
downloadkafka-python-0c0e163894c6fe4fdc4d3fe1beec2414d367bfbd.tar.gz
Update README with examples
Diffstat (limited to 'README.md')
-rw-r--r--README.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/README.md b/README.md
index 6fb199f..a7fbd6c 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,17 @@ if response:
print(response[0].error)
print(response[0].offset)
+# To send messages in batch. You can use any of the available
+# producers for doing this. The following producer will collect
+# messages in batch and send them to Kafka after 20 messages are
+# collected or every 60 seconds
+# Notes:
+# * If the producer dies before the messages are sent, there will be losses
+# * Call producer.stop() to send the messages and cleanup
+producer = SimpleProducer(kafka, "my-topic", batch_send=True,
+ batch_send_every_n=20,
+ batch_send_every_t=60)
+
# To consume messages
consumer = SimpleConsumer(kafka, "my-group", "my-topic")
for message in consumer: