Skip to content

Instantly share code, notes, and snippets.

@antunesleo
Last active May 12, 2023 16:56
Show Gist options
  • Save antunesleo/e91b7f5a88a373202bbc2118f7b923ef to your computer and use it in GitHub Desktop.
Save antunesleo/e91b7f5a88a373202bbc2118f7b923ef to your computer and use it in GitHub Desktop.
import json
from kafka import KafkaConsumer
from outboxexample import settings
print("starting consumer", settings.KAFKA_HOST)
NOTES_TOPIC = "notes"
consumer = KafkaConsumer(
NOTES_TOPIC,
bootstrap_servers=[settings.KAFKA_HOST],
value_deserializer=lambda m: json.loads(m.decode("utf-8")),
)
for message in consumer:
print(message.value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment