From 5247b2bf933c914ef0c050cf2c6101b50ecd15e2 Mon Sep 17 00:00:00 2001 From: extreme4all <> Date: Wed, 22 May 2024 00:03:34 +0200 Subject: [PATCH] send_message --- src/core/server.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/server.py b/src/core/server.py index 3c53097..4fa5ecf 100644 --- a/src/core/server.py +++ b/src/core/server.py @@ -42,6 +42,14 @@ async def lifespan(app: FastAPI): logger.info("startup initiated") config.producer = await _kafka.kafka_producer() config.send_queue = asyncio.Queue(maxsize=500) + asyncio.create_task( + _kafka.send_messages( + topic="report", + producer=config.producer, + send_queue=config.send_queue, + shutdown_event=config.sd_event, + ) + ) yield config.sd_event.set() await config.producer.stop()