From 4521279aca01cd280ca2528332338e09bd735733 Mon Sep 17 00:00:00 2001 From: TheByronHimes Date: Wed, 4 Sep 2024 14:47:45 +0000 Subject: [PATCH] Use SSL config --- src/sms/core/events_handler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sms/core/events_handler.py b/src/sms/core/events_handler.py index eba423b..c00e410 100644 --- a/src/sms/core/events_handler.py +++ b/src/sms/core/events_handler.py @@ -19,6 +19,7 @@ from aiokafka import TopicPartition from aiokafka.admin import AIOKafkaAdminClient, RecordsToDelete +from hexkit.providers.akafka.provider.utils import generate_ssl_context from sms.config import Config from sms.ports.inbound.events_handler import EventsHandlerPort @@ -33,7 +34,11 @@ def __init__(self, *, config: Config): @asynccontextmanager async def get_admin_client(self) -> AsyncGenerator[AIOKafkaAdminClient, None]: """Construct and return an instance of AIOKafkaAdminClient that is closed after use.""" - admin_client = AIOKafkaAdminClient(bootstrap_servers=self._config.kafka_servers) + admin_client = AIOKafkaAdminClient( + bootstrap_servers=self._config.kafka_servers, + security_protocol=self._config.kafka_security_protocol, + ssl_context=generate_ssl_context(self._config), + ) await admin_client.start() try: yield admin_client