Can we read data from special topic like dropped or dead in hivemq. If yes then How we can read and will there be any consequences by doing this ?
We have hivemq enterprise edition as well.
Can we read data from special topic like dropped or dead in hivemq. If yes then How we can read and will there be any consequences by doing this ?
We have hivemq enterprise edition as well.
Hi @Rahul,
HiveMQ Community Edition does not support the MQTT Topic Add-ons, which are part of HiveMQ Professional and Enterprise Edition.
In case you are using a licensed version of HiveMQ you can follow the linked documentation to enable the $dropped
, $expired
and $dead
topic.
Kind regards,
Florian
Hi Feaschbi,
Thanks for the update !
Is there any way to see hivemq dead/expired messages somewhere because I can’t see these messages on control center.
Thanks
Hi Rahul,
As Florian has explained above, $dead/$dropped/$expired HiveMQ Add-ons, are available with Professional and Enterprise flavour.
To “see” these topics, on the broker side, the corresponding Add-ons need to be enabled in the config.xml
and your clients should be given permissions to these topics. You can find the details in our documentation: MQTT Topic Add-ons .
In case if you have further questions, please do not hesitate to ask us
Kind regards,
Dasha from HiveMQ Team
Hi Daria_H,
I have done configuration for special topic.
true
true
true
Just wanted to know do we have any visibility on hivemq web ui for dead/expired messages like we have for dropped message in hivemq ?
Thanks
Hi Rahul,
You have asked “Just wanted to know do we have any visibility on hivemq web ui for dead/expired messages like we have for dropped message in hivemq ?” – No, you can only subscribe a client to the corresponding $expired/ $dead/ or $dropped/topic.
The configuration where you enable the Mqtt-Addons should be in the config.xml file of the HiveMQ Broker.
Kind regards,
Dasha from HiveMQ team
Hi Daria,
Thanks for the update.
I have made changes in config.xml by adding mqtt-add-on. Actually, I’m looking how can we generate dead message scenario so that I can subscribe ?
Thanks !
Hi Rahul,
You have asked " how can we generate dead message scenario so that I can subscribe". Advice: Next time please specify what scenario(s) you have already tried and what did not work – that will make our conversation more productive.
I have “generated dead message scenario” in the following way:
Step 1. Enable the dead-topic MQTT add-on. Update config.xml with
<mqtt-addons>
<dropped-messages-topic>
<enabled>true</enabled>
</dropped-messages-topic>
</mqtt-addons>
Step 2. Subscribe a client to the dead topic (I am using MQTT CLI):
mqtt sub -t '$dead/#' -i 'dmtSubscriber' -J -d -V 5
Step 3. Publish a message to the topic having no subscriber:
mqtt pub -i 'deadPublisher' -t 'topicToDieFor' -m "Dead message" -d -V 5
Actual result: The subscriber receives the “dead” message
{
"topic": "$dead/topicToDieFor",
"payload": "Dead message",
"qos": "AT_MOST_ONCE",
"receivedAt": "2022-02-01 11:34:25",
"retain": false,
"userProperties": {
"hmq-dead-origin": "client",
"hmq-dead-client": "deadPublisher",
"hmq-dead-timestamp": "1643711665348"
}
}
Client 'dmtSubscriber@localhost' received PUBLISH ('Dead message') MqttPublish{topic=$dead/topicToDieFor, payload=12byte, qos=AT_MOST_ONCE, retain=false, userProperties=[(hmq-dead-origin, client), (hmq-dead-client, deadPublisher), (hmq-dead-timestamp, 1643711665348)]}
I hope this helps,
Kind regards
Dasha from HiveMQ team
Hi Daria_H,
Thanks for the quick response.
You have enabled only dropped message topic. Will that work for dead message because I have enabled all three special topics.
<mqtt-addons>
<dead-messages-topic>
<enabled>true</enabled>
</dead-messages-topic>
<dropped-messages-topic>
<enabled>true</enabled>
</dropped-messages-topic>
<expired-messages-topic>
<enabled>true</enabled>
</expired-messages-topic>
</mqtt-addons>
In my case
Step1 : Publishing message to random topic
Step 2 : Subscribing message from $dead/# topic
result : unable to read data from dead topic after following above steps.
Please have a look on it.
Thanks !
Hi @Rahul,
You need to subscribe to the $dead
topic first, before you publish the message to capture it being republished.
You cannot “read from topics” in MQTT. Topics are communication channels on which messages are distributed in-flight.
See the MQTT Essentials for more details.
Best,
Florian
Hi Florian,
It’s my bad. Yes I understood we can not read from topics but I was trying to say subscribing instead of reading term in above message.
My subscriber is already attached to the ‘$dead/#’ topic and publishing message to ‘test’ topics which is not attached to the any subscriber, But still unable to subscribe any records from ‘$dead/#’ topics.
Hivemq add-on I have mentioned in above messages.
And Lastly, I’m using hiveme docker 4.5 image with enterprise edition.
Thanks !
Hi Rahul,
In order to get help troubleshooting this issue, you please post your “subscribe” and “publish” commands here, see example in my post.
Thanks!
Dasha from HiveMQ team
Hi Daria_H,
I have been using MqttFx client for testing and connectivity purpose.
Here is a screen shot which I have been trying.
Hi @Rahul,
can you please post your config.xml, not that there is a misconfiguration and the special topics aren’t enabled. Also what HiveMQ version are you using? The dead topic is a feature we shipped with 4.6
Edit: I saw this line:
And Lastly, I’m using hiveme docker 4.5 image with enterprise edition.
This means the $dead topic is not supported in the HiveMQ version you are using, you’ll have to use at least HiveMQ 4.6.0.
Greetings,
Michael from the HiveMQ team
Hi Michael,
Thanks for your response.
I’m using Hivemq 4.5 version. I think, I have to upgrade the hivemq version.
Please provide response for below queries if possible.
What about the ‘$expired/#’ topic ?
How ‘$expired/#’ topic will behave in mqtt 3.1 versus mqtt 5 ?
Thanks !
Hi @Rahul,
yes you’ll have to upgrade to at least 4.6.0.
The “special” topics don’t really differentiate between MQTT 3 or MQTT 5. So when an MQTT publish expires, be it from an MQTT 3 or MQTT 5 client, it will be sent to $expired/. Same applies to $dead and $dropped.
Greetings,
Michael from the HiveMQ team
Hi @michael_w,
I have gone through the blog. According to that, we can not define expiry time interval for a message in 3.1.1 mqtt protocol implementation that only possible in mqtt 5 protocol.
Could you please have a look on it ?
Thanks !
Hi @Rahul,
yes you are correct, maybe I should have explained that a little more. HiveMQ allows you to apply many of the MQTT 5 features to MQTT 3 clients/packets (like setting a message expiry for an MQTT 3 publish).
This can be done with:
publish.setMessageExpiryInterval(120L);
)Greetings,
Michael