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 »

Trace recordings offer a filtered view of what happened for a given set of clients and/or topics on the broker during a defined time period. Generating these recordings with a well chosen filter can make assessing behaviour vastly easier, as only the desired information is logged.

In this guide we will look at how to create a trace recording in the special case of a shared subscription.

Prerequisites

In our example we will be inspecting the topic our/topic to which we will subscribe two clients in a single, joint subscriber group (group00).

Using the MQTT CLI, this can be achieved by running the following commands in separate terminals

mqtt sub -t '$share/group00/our/topic' -h localhost -i client00 
mqtt sub -t '$share/group00/our/topic' -h localhost -i client01

These sessions must remain active throughout our entire test.

Configuring the Trace Recording

Initiating, managing and downloading Trace Recordings is done in the HiveMQ Control Center.

Here we must Add New Trace Recording in order to reach the configuration mask.

First, choose a new, unique name. This need not match a topic name and only serves to help identify the recording we are about to create.

Next, we have to define a Topic Filter. Note that we must specify the actual topic here and not include the definition of our share group!

After clicking Add Topic Filter it should become visible as an existing filter:

From here we can select the types of messages we are interested in. As our subscribers are ready and waiting, we are only interested in PUBLISH messages.

Finally, after making sure that Start Date is set to a past time and the selected End Date is far enough into the future to cover our efforts, we are ready to Start Trace Recording.

Don’t worry about timing it just right or otherwise having to wait for your recording to end. Trace Recordings can be stopped at any time

Upon success, your new recording will show up in the overview with the name you specified:

Generate test data

In order to verify our recording works as expected, we will publish messages to the topic.

You can use the following loop to send 10 different messages

for i in `seq 0 9`; do mqtt pub -t 'our/topic' -h 127.0.0.1 -m "message0$i" -i publisher00; done

If your subscriber group is set up correctly, the messages should be split between them. No individual message should be visible to both subscribers in the group.

Inspecting the Trace Recording

Once our publishing run is complete, we may

  • stop the Trace Recording by clicking stop

  • have HiveMQ prepare the resulting output by clicking download

  • and click save to receive the resulting compressed trace recording

After unpacking the downloaded file, the resulting .trace file can be inspected with any text editor.

You should see a Sent and corresponding Received for each message, similar to the following:

2020-04-08 14:54:25,195 - [publisher00] - Received PUBLISH message (topic: our/topic, QoS: 0, retain: false, duplicate delivery: false)
2020-04-08 14:54:25,197 - [client01] - Sent PUBLISH message (topic: our/topic, QoS: 0, retain: false, duplicate delivery: false, subscription identifiers: [1])
  • No labels