Skip to content

Instantly share code, notes, and snippets.

@hhstore
Created September 12, 2018 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhstore/636b237b6b183e1c83cc1580b55b9465 to your computer and use it in GitHub Desktop.
Save hhstore/636b237b6b183e1c83cc1580b55b9465 to your computer and use it in GitHub Desktop.
kafka: consumer
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