Skip to content

Instantly share code, notes, and snippets.

@danthelion
Created October 20, 2022 11:10
Show Gist options
  • Save danthelion/cbb50a4ee6997aa84e4ac4c39b7c626c to your computer and use it in GitHub Desktop.
Save danthelion/cbb50a4ee6997aa84e4ac4c39b7c626c to your computer and use it in GitHub Desktop.
dob producer
for i in range(100):
data = {
"ts": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"),
"name": fake.name(),
"country": fake.country(),
"date-of-birth": str(fake.date_of_birth(tzinfo=None, minimum_age=0, maximum_age=100)),
}
producer.send(topic=TOPIC, key=str(i).encode("utf-8"), value=json.dumps(data).encode("utf-8"))
print(f"Sent message {i} -> {data}")
sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment