You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
565 B
19 lines
565 B
2 months ago
|
import asyncio
|
||
|
from AgenticInterfaces.KafkaClient import KafkaClient
|
||
|
|
||
|
bootstrap_servers = "kafka:9092"
|
||
|
request_topic = "request_llm_topic"
|
||
|
|
||
|
async def send_periodic_messages():
|
||
|
kafka_client = KafkaClient(topic=request_topic, bootstrap_servers=bootstrap_servers)
|
||
|
await kafka_client.start()
|
||
|
|
||
|
try:
|
||
|
while True:
|
||
|
message = {"text": "Пример сообщения"}
|
||
|
await kafka_client.send_message(message)
|
||
|
await asyncio.sleep(5)
|
||
|
finally:
|
||
|
await kafka_client.stop()
|
||
|
|
||
|
asyncio.run(send_periodic_messages())
|