-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (25 loc) · 863 Bytes
/
app.py
File metadata and controls
33 lines (25 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# app.py
import sys
import asyncio
import producer
import consumer
from dotenv import load_dotenv
load_dotenv()
async def main():
if len(sys.argv) < 2:
print("Usage: python app.py <produce|consume>")
return
command = sys.argv[1].lower()
if command == "produce":
# Call produce.py's async produce function
await producer.produce()
elif command == "consume":
# Call the async consumer function
await consumer.consume()
else:
print("Invalid argument. Use 'produce' or 'consume'.")
if __name__ == "__main__":
asyncio.run(main())
# HELP! My neighbor's favorite topic is pets, but he always gets my cats name wrong!
# I've suggested he look on pk-kafka-kafka-bootstrap.pk-world.svc.cluster.local for my cats name
# Think you can find my cats name?