Skip to content

Commit

Permalink
send_message
Browse files Browse the repository at this point in the history
  • Loading branch information
extreme4all committed May 21, 2024
1 parent 96ad9e7 commit 5247b2b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5247b2b

Please sign in to comment.