خرید بک لینک

Vote count: 0

I installed the kafka-python package for Python. I have a kafka producer and consumer ruing. I want the python code to read the kafka topic and print out the messages.

My python code is below:

import sys from kafka import KafkaConsumer

def kafkatest(): print "Step 1 complete" consumer=KafkaConsumer('test',bootstrap_servers=['localhost:9092']) for message in consumer: print "Next message" print message

if name=="main": kafkatest()

I get the following error:

C:Python27>python.exe kafka.py Traceback (most recent call last): File "kafka.py", line 2, in from kafka import KafkaConsumer File "C:Python27kafka.py", line 2, in from kafka import KafkaConsumer ImportError: caot import name KafkaConsumer

Any suggestions on what I am missing here?

asked 14 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 8 مرداد 1395 ساعت: 5:58

صفحه بندی