There is no Kafka environment, so there is no validation. I feel that I should be able to use it in the future, so I'm borrowing and copying it here for future reference.
Example of pykafka usage with automatic consumption of latest news without duplication:
# -* coding:utf8 *- from pykafka import KafkaClient host = '192.168.200.38' client = KafkaClient(hosts="%s:9092" % host) print # Producers # topicdocu = ['task_pull'] # producer = topicdocu.get_producer() # for i in range(4): # print i # ('test message ' + str(i ** 2)) # () # Consumers topic = ['task_push'] consumer = topic.get_simple_consumer(consumer_group='test', auto_commit_enable=True, consumer_id='test') for message in consumer: if message is not None: print ,
This above method of receiving Kafka message queues through pykafka is all I have to share with you, I hope to give you a reference, and I hope you will support me more.