Skip to content

Instantly share code, notes, and snippets.

@ottomata
Created February 15, 2018 20:34
Show Gist options
  • Save ottomata/a131dc97344c70baa6ab33a08a0b457e to your computer and use it in GitHub Desktop.
Save ottomata/a131dc97344c70baa6ab33a08a0b457e to your computer and use it in GitHub Desktop.
from kafka import KafkaConsumer
import json
from pprint import pprint
# To consume latest messages and auto-commit offsets
consumer = KafkaConsumer(
'eventlogging_TestSearchSatisfaction2',
group_id='otto1',
bootstrap_servers=['kafka1012:9092']
)
for message in consumer:
e = json.loads(message.value)
if e['event']['action'] == 'click':
pprint(e['event'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment