My Kafka is not getting any messages

My Kafka is not getting any messages

Problem

HiveMQ Cloud cannot connect to your Kafka cluster. This issue often manifests as:

  • No messages arriving in Kafka from MQTT

  • Timeout or connection errors in HiveMQ extensions

  • Errors during connector setup or runtime logs showing "connection refused" or "host unreachable"

Solution

The most common root cause is that your Kafka cluster is not reachable over the public internet. HiveMQ Cloud – particularly the Starter and Serverless (Free/PayG) tier – needs to access your Kafka cluster via public IP or DNS.

To verify if your Kafka cluster is publicly reachable, use the kafkacat CLI tool from a public network (e.g., a cloud-hosted VM or your local machine without VPN restrictions).

  1. Install kafkacat (or kcat, its successor):

    1. macOS: brew install kafkacat

    2. Linux (Debian/Ubuntu): sudo apt install kafkacat

    3. Docker: docker run -it edenhill/kcat

  2. Run the connection test:

    kafkacat -b <your-kafka-bootstrap-server>:<port> -L

    Replace <your-kafka-bootstrap-server> with your Kafka broker's address (e.g., kafka.mycompany.com:9092).

    Example:

    kafkacat -b kafka.mycompany.com:9092 -L
  3. What to look for:

    • If you see broker and topic metadata: Kafka is reachable.

    • If you see errors like Connection refused or Name or service not known: Kafka is not accessible from the internet.

Related articles