blob: 2fd61e83bda034138956d47c4ffd0e72ea90fa26 [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):
11 #consumer = KafkaConsumer(bootstrap_servers='10.100.198.220:9092',
12 consumer = KafkaConsumer(bootstrap_servers='10.0.2.15:9092',
13 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