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
590 B

import asyncio
from AgenticInterfaces.KafkaClient import KafkaClient
bootstrap_servers = "kafka:9092"
response_topic = "response_llm_topic"
async def print_received_messages(message):
print("Получено сообщение:", message["text"])
async def receive_messages():
kafka_client = KafkaClient(topic=response_topic, bootstrap_servers=bootstrap_servers, group_id="response-group")
await kafka_client.start()
try:
await kafka_client.consume_messages(print_received_messages)
finally:
await kafka_client.stop()
asyncio.run(receive_messages())