blob: f6ae9ad771a1613a4541102e117028a085a64856 [file] [log] [blame]
khenb95fe9a2016-10-05 11:15:25 -07001#!/usr/bin/env python
2import threading, logging, time
3
4from kafka import KafkaConsumer
5
6
7class Consumer(threading.Thread):
8 daemon = True
9
10 def run(self):
khenea2922c2016-10-05 11:17:31 -070011 consumer = KafkaConsumer(bootstrap_servers='10.100.198.220:9092',
12 #consumer = KafkaConsumer(bootstrap_servers='10.0.2.15:9092',
khenb95fe9a2016-10-05 11:15:25 -070013 auto_offset_reset='earliest')
14 consumer.subscribe(['voltha-heartbeat'])
15
16 for message in consumer:
17 print (message)
18
19
20def main():
21 threads = [
22 Consumer()
23 ]
24
25 for t in threads:
26 t.start()
27
28 time.sleep(3000)
29
30if __name__ == "__main__":
31 logging.basicConfig(
32 format='%(asctime)s.%(msecs)s:%(name)s:%(thread)d:%(levelname)s:%(process)d:%(message)s',
33 level=logging.INFO
34 )
35 main()
36