Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

  1. Prepare a simple configuration file for kafka-extension as in the example below.

    • this example configuration will map all incoming MQTT publish packets to the topic “test” in Kafka; and will map the topic “test” in Kafka to the topic “test” in the HiveMQ broker

    • Use your password in <password>here_is_your_password</password>, that you successfully retrieved with this command a few steps ago:

      Code Block
      languagebash
      kubectl get secret kafka-user-passwords --namespace kafka \
        -o jsonpath='{.data.client-passwords}' | base64 -d | cut -d , -f 1;
    • Here is the file:

...

  1. Subscribe a reference MQTT client to the topic “test”, The output shows the topic name and message: (please update your hostname with the DNS name or public IP address of your hivemq-hivemq-mqtt service, 20.113.46.120 in our test)

    Code Block
    languagebash
    mqtt subscribe --topic '#' --host 20.113.46.120 --port 1883 -q 1 --showTopics

    Do not close this terminal session!

  2. From a different terminal session, publish a message to the topic “test”:(please update your hostname with the DNS name or public IP address of your hivemq-hivemq-mqtt service, 20.113.46.120 in our test)

    Code Block
    languagebash
    mqtt publish --topic test --message Hello --host 20.113.46.120 --port 1883 -q 1
  3. If everything is correct, the subscriber will indefinitely receive the message we published. You can stop this by terminating the execution of the command by pressing Ctrl+C.

    Code Block
    mqtt subscribe --topic '#' --host $hivemqhost --port 1883 -q 1 --showTopics
    
    test: Hello
    test: Hello
    test: Hello
    test: Hello
    ........
  4. the Kafka Dashboard in the HiveMQ Control Center shows incoming and outgoing Kafka messaging:

...

Check out the official extension page for further details on setup and configuration https://docs.hivemq.com/hivemq-kafka-extension/latest/index.html