class_docstr: A base hook for interacting with Apache Kafka.
  
  :param kafka_config_id: The connection object to use, defaults to "kafka_default"
class_docstr_tok: ["A","base","hook","for","interacting","with","Apache","Kafka",".",":","param","kafka_config_id",":","The","connection","object","to","use",",","defaults","to","``","kafka_default","''"]
docstr: Test Connectivity from the UI.
docstr_tok: ["Test","Connectivity","from","the","UI","."]
code: def test_connection(self) -> tuple[bool, str]:
      """Test Connectivity from the UI."""
      try:
          config = self.get_connection(
              self.kafka_config_id
          ).extra_dejson
          t = AdminClient(config, timeout=10).list_topics()
          if t:
              return True, "Connection successful."
      except Exception as e:
          False, str(e)
  
      return False, "Failed to establish connection."
  
file_path: airflow/airflow/providers/apache/kafka/hooks/base.py
imports: from __future__ import annotations
  from functools import cached_property
  from typing import Any
  from confluent_kafka.admin import AdminClient
  from airflow.hooks.base import BaseHook
label_desc: Use image node_id 5 for calling the KafkaBaseHook obj's underlying member method code with example usage: obj.test_connection() and returns: False,  str, True,  str