Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

\uD83D\uDCD8 Instructions

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

  2. On the broker, enable MQTT Topic Addons.

  3. On the localhost, install MQTT CLI command line client.

  4. Start the broker.

  5. To monitor for expired messages, create a client sub-expired with subscription to $expired/# topic filter or a shared subscription $share/shared-expired/$expired:

    mqtt subscribe -i sub-expired -t '$expired/#' -J -d

    where:

    • -i 'sub-expired' – client identifier;

    • -t '$expired/#' – topic filter;

    • -J – output as JSON;

    • -d – verbose output.

  6. Create a client sub-test with subscription to some topic test with a long session expiry and disconnect the client. To disconnect the command line client, terminate its terminal session by pressing Ctrl+C:

    mqtt subscribe -i sub-test -t test -se 6000 --no-cleanStart

    where:

    • -se 6000 – session expiry 600 seconds;

    • --no-cleanStart – persistent session;

  7. In the brokers Control Center → Clients → Refresh View and make sure that the client sub-test is present in the list, subscribed to the topic test and offline.

  8. Publish a message to the topic test from MQTT v.5 client, with a short message expiry and QoS 1.

    mqtt publish -i pub-test -t test -m Hello -V 5 -e 2

    where:

    • -m Hello – message “Hello”;

    • -V 5 – MQTT v.5 client;

    • -e 2 – message expiry 2s;

Expected result:

After a short message expiry interval the message expires, published to the topic $expired/test and received by the sub-expired client.

  • No labels