mumrah/kafka-python — pull request #188 by jiabai (2014-08-07 08:07:34+00:00)
Title: Zkcommit

hi @mahendra, i had just used your kafka-python zk version recently, found yeah it could check offset in the zk, it's great! but when i started a process ZSimpleConsumer from a machine, and started another process ZSimpleConsumer from another machine with the same code, i found kafka not rebalancing partitions. if the process A started and consumed data from kafka, the process B would wait, then waited about one minute, the first process broke down and the second would start behind the first. so, do i use it with a wrong way ? i have been confused for a long time...

my kafka is 0.8.0, i download kafka-python from here: https://github.com/mahendra/kafka-python/tree/zkcommit

my code here:
from kafka.zookeeper import ZSimpleProducer, ZKeyedProducer
from kafka.zookeeper import ZSimpleConsumer
from kafka.partitioner import HashedPartitioner

consumer = ZSimpleConsumer("192.168.3.136:2181", "my-group", "ipadvv",
manage_offsets=True)

for msg in consumer:
print msg

my Error here:
Traceback (most recent call last):
File "kafkaTest.py", line 8, in
for msg in consumer:
File "/usr/local/lib/python2.7/site-packages/kafka/zookeeper.py", line 521, in __iter__
for msg in self.consumer:
File "/usr/local/lib/python2.7/site-packages/kafka/consumer.py", line 413, in __iter__
yield it.next()
File "/usr/local/lib/python2.7/site-packages/kafka/consumer.py", line 449, in __iter_partition__
min_bytes=self.fetch_min_bytes)
File "/usr/local/lib/python2.7/site-packages/kafka/client.py", line 268, in send_fetch_request
KafkaProtocol.decode_fetch_response)
File "/usr/local/lib/python2.7/site-packages/kafka/client.py", line 174, in _send_broker_aware_request
except (socket.error, KafkaConnectionError) as exp:
NameError: global name 'KafkaConnectionError' is not defined

Thank You!!