When initializing a connection to a none existent kafka broker the client is sending error to stdout but when I add a try block its not throwing an exception. In the documentation the admin client should raise KafkaException.
confluent-kafka==2.2.0
%3|1729693737.667|FAIL|rdkafka#producer-1| [thrd:ssl://kafka.test-123.com:443/bootstrap]: ssl://kafka.test-123.com:443/bootstrap: Failed to resolve 'kafka.test-123.com:443': No such host is known. (after 27ms in state CONNECT)
from confluent_kafka import admin, KafkaException, KafkaError
KAFKA_BROKER = "kafka.test-123.com:443"
KAFKA_ADMIN_CONFIG = {
'bootstrap.servers':KAFKA_BROKER,
'security.protocol':'SSL',
}
try:
admin.AdminClient(KAFKA_ADMIN_CONFIG)
except (KafkaException, KafkaError) as e:
print("failed")
You need to sign in to view this answers
Leave feedback about this