diff options
| author | David Arthur <mumrah@gmail.com> | 2013-07-26 08:39:44 -0400 |
|---|---|---|
| committer | David Arthur <mumrah@gmail.com> | 2013-07-26 08:39:44 -0400 |
| commit | e297a7a8c8f9de341b0e91346236455d12ae7f82 (patch) | |
| tree | f4db35ab88fa39684d4ab680428adf815000eaa5 /README.md | |
| parent | 5684af438e6cf871540aa8ea8b556737f56e9798 (diff) | |
| parent | 1d278f0f60cb0a7b76fbc6b80c8e112a0deb2e0c (diff) | |
| download | kafka-python-e297a7a8c8f9de341b0e91346236455d12ae7f82.tar.gz | |
Merge branch 'issue-35'
Conflicts:
kafka/__init__.py
kafka/consumer.py
test/test_integration.py
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -89,6 +89,24 @@ producer.send("key2", "this methode") producer = KeyedProducer(kafka, "my-topic", partitioner=RoundRobinPartitioner) ``` +## Multiprocess consumer +```python +from kafka.consume import MultiProcessConsumer + +# This will split the number of partitions among two processes +consumer = MultiProcessConsumer(kafka, "my-topic", "my-group", num_procs=2) + +# This will spawn processes such that each handles 2 partitions max +consumer = MultiProcessConsumer(kafka, "my-topic", "my-group", + partitions_per_proc=2) + +for message in consumer: + print(message) + +for message in consumer.get_messages(count=5, block=True, timeout=4): + print(message) +``` + ## Low level ```python |
