[Python] Confluent Kafka admin client not throwing exception

Discussão em 'Python' iniciado por Stack, Outubro 23, 2024.

  1. Stack

    Stack Membro Participativo

    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 documentation

    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")

    Continue reading...

Compartilhe esta Página