Created
October 20, 2022 11:10
-
-
Save danthelion/cbb50a4ee6997aa84e4ac4c39b7c626c to your computer and use it in GitHub Desktop.
dob producer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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