API 文档在这里: http: //kafka-python.readthedocs.org/en/latest/apidoc/kafka.consumer.html
但是当我运行以下代码时,异常是%d 格式:需要一个数字,而不是 NoneType
client = KafkaClient("localhost:9092")
consumer = SimpleConsumer(client, "test-group", "test")
consumer.seek(0, whence=None)# (0,2) and (0,0)
run = True
while( run ):
message = consumer.get_message(block=False, timeout=4000)
except Exception as e:
print "Exception while trying to read msg:", str(e)
当我使用以下代码时,异常是seek() got an unexpected keyword argument 'partition'
consumer.seek(0, whence=None, partition=None)# (0,2) and (0,0)
任何想法?谢谢。