Skip to content

Commit

Permalink
Merge pull request #20 from datasci4health/development
Browse files Browse the repository at this point in the history
adding stream debug messages
  • Loading branch information
matheusmota authored Sep 13, 2020
2 parents 64b6d4f + 272363e commit 96b5ae7
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 96b5ae7

Please sign in to comment.