Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article is to explain how to generate an “expired” message and how to catch it in the $expired/# topic.

\uD83D\uDCD8 Instructions

  1. Prepare a HiveMQ broker with a TCP listener on localhost:1883.

  2. On the broker, enable Expired Messages Topic add-on.
    Enabling Expired Messages Topic add-on has 2 workings:

    1. The Expired Messages Topic add-on prefaces the topic of expired messages with $expired/.
      So, if a message published to my/topic/test is expired, it will be published to topic $expired/my/topic/test.

    2. The Expired Messages Topic add-on exposes additional metrics in the HiveMQ standard metrics:

      • com.hivemq.messages.expired-messages

      • com.hivemq.messages.expired.topic.expired.count

        and other metrics.

Following steps explain how to create a situation when a message is expired.

...

  1. is published to the topic $expired/test and received by the sub-expired client.

  2. metrics updated
    com.hivemq.messages.expired-messages
    com.hivemq.messages.expired.topic.expired.count

Info

Script for quickly setting up a test environment with HiveMQ with Prometheus and Grafana monitoring: https://github.com/guinp1n/docker-hivemq-with-prometheus