Skip to content

Instantly share code, notes, and snippets.

Created May 12, 2022 05:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
import random
from time import sleep
import requests
import logging
import json
from dapr.clients import DaprClient
logging.basicConfig(level = logging.INFO)
while True:
sleep(random.randrange(50, 5000) / 1000)
orderId = random.randint(1, 1000)
PUBSUB_NAME = 'order-pub-sub'
TOPIC_NAME = 'orders'
with DaprClient() as client:
#Using Dapr SDK to publish a topic
result = client.publish_event(
)'Published data: ' + str(orderId))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment