@qualithm/kafka-client - v0.1.6
    Preparing search index...

    Class Kafka

    Top-level Kafka client.

    Manages the connection pool and provides the entry point for producing, consuming, and administering Kafka clusters.

    const kafka = createKafka({
    config: { brokers: ["localhost:9092"] },
    socketFactory: createNodeSocketFactory(),
    })
    await kafka.connect()
    // ... use kafka ...
    await kafka.disconnect()
    Index

    Constructors

    Accessors

    Methods

    • Connect to the Kafka cluster.

      Discovers brokers via the Metadata API and establishes the connection pool. Must be called before using producer, consumer, or admin clients.

      Calling connect() on an already-connected client is a no-op.

      Returns Promise<void>

      If connecting fails or the client is disconnecting.

    • Disconnect from the Kafka cluster.

      Closes all connections and shuts down the connection pool. Calling disconnect() on an already-disconnected client is a no-op.

      Returns Promise<void>

      If the client is currently connecting.

    • Refresh broker metadata.

      Re-discovers brokers from the cluster to pick up topology changes.

      Returns Promise<void>

      If the client is not connected.