Skip to content

Commit

Permalink
added log to check the count of events
Browse files Browse the repository at this point in the history
  • Loading branch information
RK206 authored and Steven-Eardley committed Aug 3, 2023
1 parent 0dc5608 commit 35a7367
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion portality/events/kafka_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
app = faust.App('events', broker=broker, value_serializer='json')
topic = app.topic(topic_name)

event_counter = 0


@app.agent(topic)
async def handle_event(stream):
global event_counter
with doajapp.test_request_context("/"):
svc = DOAJ.eventsService()
async for event in stream:
pass
event_counter += 1
doajapp.logger.info(f"Kafka event count {event_counter}")
# TODO uncomment the following line once the Event model is fixed to Kafka
# svc.consume(Event(raw=json.loads(event)))

Expand Down

0 comments on commit 35a7367

Please sign in to comment.