diff options
author | John Anderson <sontek@gmail.com> | 2015-02-09 14:27:42 -0800 |
---|---|---|
committer | John Anderson <sontek@gmail.com> | 2015-02-09 14:27:42 -0800 |
commit | aa19d71f9804f431199f4f68087ad4a53b0cbab9 (patch) | |
tree | 86bc6397f1262e2cb121a02a0413cdf276a99140 /docs | |
parent | f206a4bbf0b0e39cf13c7c5918a99abc085d004d (diff) | |
download | kafka-python-aa19d71f9804f431199f4f68087ad4a53b0cbab9.tar.gz |
Updated documentation for Consumers to prefer KafkaConsumer instead
Diffstat (limited to 'docs')
-rw-r--r-- | docs/usage.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/usage.rst b/docs/usage.rst index 5f3fcea..141cf93 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -6,7 +6,7 @@ High level .. code:: python - from kafka import KafkaClient, SimpleProducer, SimpleConsumer + from kafka import SimpleProducer, KafkaClient, KafkaConsumer # To send messages synchronously kafka = KafkaClient("localhost:9092") @@ -52,7 +52,8 @@ High level batch_send_every_t=60) # To consume messages - consumer = SimpleConsumer(kafka, "my-group", "my-topic") + consumer = KafkaConsumer("my-topic", group_id="my_group", + metadata_broker_list=["localhost:9092"]) for message in consumer: # message is raw byte string -- decode if necessary! # e.g., for unicode: `message.decode('utf-8')` @@ -66,7 +67,8 @@ Keyed messages .. code:: python - from kafka import KafkaClient, KeyedProducer, HashedPartitioner, RoundRobinPartitioner + from kafka import (KafkaClient, KeyedProducer, HashedPartitioner, + RoundRobinPartitioner) kafka = KafkaClient("localhost:9092") |