Created
September 12, 2018 02:49
-
-
Save hhstore/636b237b6b183e1c83cc1580b55b9465 to your computer and use it in GitHub Desktop.
kafka: consumer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kafka import KafkaConsumer, KafkaProducer | |
SERVERS = ['localhost:9092', ] | |
def consume(): | |
c = KafkaConsumer("topic1", group_id='group1', bootstrap_servers=SERVERS) | |
for msg in c: | |
print("consume:", msg) | |
if __name__ == '__main__': | |
consume() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment