18 lines
380 B
Python
18 lines
380 B
Python
from typing import Optional
|
|
|
|
from aiokafka import AIOKafkaProducer
|
|
|
|
from backend.config import KAFKA_URL
|
|
from external.kafka.context import context
|
|
|
|
producer: Optional[AIOKafkaProducer] = None
|
|
|
|
|
|
async def init_producer():
|
|
global producer
|
|
producer = AIOKafkaProducer(
|
|
bootstrap_servers=KAFKA_URL,
|
|
security_protocol='SSL',
|
|
ssl_context=context,
|
|
)
|