Skip to content

Commit

Permalink
finalized emqx demo
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiionutdamian committed Feb 19, 2024
1 parent 5253320 commit 26231f7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Binary file modified labs/labs-internal/emqx/app/src/__pycache__/base.cpython-310.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions labs/labs-internal/emqx/app/src/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, *args, **kwargs):

def publish_messages(self):
"""Publish messages with a specific structure."""
self.P("Starting publisher thread {} ...".format(self.thread_id))
while True:
self.count += 1
payload = json.dumps({
Expand All @@ -38,8 +39,8 @@ def publish_messages(self):

def run(self):
"""Run the publisher."""
thread = threading.Thread(target=self.publish_messages)
thread.start()
self.thread = threading.Thread(target=self.publish_messages)
self.thread.start()
return

if __name__ == '__main__':
Expand Down
1 change: 1 addition & 0 deletions labs/labs-internal/emqx/app/src/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def display_stats(self, ):
"""Periodically display message stats."""
while True:
for sender, sum_ in self.messages.items():
self.P("----------------------------------------")
self.P(f"{sender} -> sum -> {sum_} (id: {self.counters[sender]})")
time.sleep(10) # Adjust as necessary
return
Expand Down

0 comments on commit 26231f7

Please sign in to comment.