Skip to content

Commit

Permalink
adding stream debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusmota authored Sep 13, 2020
1 parent 370d1fa commit 272363e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ def run(self):
print("Checking for newly streamed messages during at least {} seconds...".format(self.delay))
try:
for message in self.kafka_consumer:
#print ("%s:%d:%d: key=%s value=%s" % (message.topic, message.partition, message.offset, message.key, message.value))
print()
print ("> New message | %s:%d:%d: key=%s value=%s" % (message.topic, message.partition, message.offset, message.key, message.value))
print("Found {} events inside a message ".format(len(message.value['harena-log-stream'])))
for event in message.value['harena-log-stream']:
mongodb_collection.insert_one(event)
print()
except:
print("Object is not a JSON or does not have an 'harena-log-stream' array")
print()


print("Waiting time ({} seconds) for new messages ended.".format(self.delay))
Expand Down

0 comments on commit 272363e

Please sign in to comment.