## Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending#""" The kafka module provides the utilities to both consume and produce Kakfa streams. """fromtypingimportDict,ListimportjpyfromdeephavenimportDHErrorfromdeephaven.jcompatimportj_list_to_list,j_properties_JKafkaTools=jpy.get_type("io.deephaven.kafka.KafkaTools")
[docs]deftopics(kafka_config:Dict)->List[str]:"""Returns a list of topic names available from Kafka. Args: kafka_config (Dict): configuration for the associated Kafka consumer. The content is used to call the constructor of org.apache.kafka.clients.Admin; pass any Admin specific desired configuration here Returns: a list of topic names Raises: DHError """try:kafka_config=j_properties(kafka_config)jtopics=_JKafkaTools.listTopics(kafka_config)returnlist(jtopics)exceptExceptionase:raiseDHError(e,"failed to list Kafka topics")frome