Skip to content

Commit

Permalink
Use SSL config
Browse files Browse the repository at this point in the history
  • Loading branch information
TheByronHimes committed Sep 4, 2024
1 parent cb6d620 commit 4521279
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/sms/core/events_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4521279

Please sign in to comment.