feat: fix
This commit is contained in:
		
							
								
								
									
										17
									
								
								external/kafka/producer.py
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								external/kafka/producer.py
									
									
									
									
										vendored
									
									
								
							@@ -1,10 +1,17 @@
 | 
			
		||||
from typing import Optional
 | 
			
		||||
 | 
			
		||||
from aiokafka import AIOKafkaProducer
 | 
			
		||||
 | 
			
		||||
from backend.config import KAFKA_URL
 | 
			
		||||
from external.kafka.context import context
 | 
			
		||||
 | 
			
		||||
producer = AIOKafkaProducer(
 | 
			
		||||
    bootstrap_servers=KAFKA_URL,
 | 
			
		||||
    security_protocol='SSL',
 | 
			
		||||
    ssl_context=context,
 | 
			
		||||
)
 | 
			
		||||
producer: Optional[AIOKafkaProducer] = None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def init_producer():
 | 
			
		||||
    global producer
 | 
			
		||||
    producer = AIOKafkaProducer(
 | 
			
		||||
        bootstrap_servers=KAFKA_URL,
 | 
			
		||||
        security_protocol='SSL',
 | 
			
		||||
        ssl_context=context,
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user