Skip to content

Commit

Permalink
Create Kafka client for confluent lib
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhan289 committed Mar 1, 2023
1 parent 0a0dfb5 commit 0d556d7
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from datadog_checks.kafka_consumer.client.kafka_client import KafkaClient

from confluent_kafka.admin import AdminClient

class ConfluentKafkaClient(KafkaClient):
@property
def kafka_client(self):
if self._kafka_client is None:
# self.conf is just the config options from librdkafka
self._kafka_client = AdminClient(
{
"bootstrap.servers": self.config._kafka_connect_str,
"socket.timeout.ms": self.config._request_timeout_ms,
"client.id": "dd-agent",
}
)
return self._kafka_client

def create_kafka_admin_client(self):
raise NotImplementedError

Expand Down

0 comments on commit 0d556d7

Please sign in to comment.