From aa70512c1a06ab9f073e36c59abbef00ad92ac02 Mon Sep 17 00:00:00 2001 From: dspeck1 Date: Mon, 30 Sep 2024 14:55:03 -0500 Subject: [PATCH] moved producer location and added logging. --- src/main.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main.py b/src/main.py index 7156624..261b6d1 100644 --- a/src/main.py +++ b/src/main.py @@ -158,13 +158,7 @@ async def main() -> None: sasl_mechanism=sasl_mechanism, sasl_plain_username=sasl_username, sasl_plain_password=sasl_password, - ) - - # https://aiokafka.readthedocs.io/en/stable/producer.html - producer = AIOKafkaProducer( - bootstrap_servers=prompt_processing_kafka_cluster - ) - await producer.start() + ) latiss_gauge = Gauge( "latiss_next_visit_messages", "next visit nessages with latiss as instrument" @@ -212,6 +206,13 @@ async def main() -> None: tasks = set() + # https://aiokafka.readthedocs.io/en/stable/producer.html + producer = AIOKafkaProducer( + bootstrap_servers=prompt_processing_kafka_cluster + ) + await producer.start() + logging.info ("started kafka producer") + async with httpx.AsyncClient() as client: try: