emqx-docker
emqx-docker copied to clipboard
Howto remove retain flag?
Make sure you read and understand https://developer.emqx.io/docs/emq/v3/en/index.html. Use one of the two templates below and delete the rest.
- [ x] FEATURE REQUEST
FEATURE REQUEST
remove retain flag from specific topic
Justification
Not sure if it's a bug or a missing feature, but I can't seem to find a way to remove a retain flag from a topic.
Test scenario:
- Publish a message1 to a topic with retain: true
- Subscribe to topic -> retained message1 is received
- Publish an empty message to the topic with retain: false
- Subscribe to topic -> retained message1 is received <-- Here no message was expected
Also read this https://medium.com/@emqtt/mqtt-in-a-nutshell-2040b244aa4b, but unfortunately it doesn't explain how to remove the retain flag.
As per https://emqx-enterprise-docs-en.readthedocs.io/en/latest/mqtt.html ...
Client sends an empty message using the same topic of the retained message should clean retain, but I've tried this with node-red and mqttfx as clients, but it doesn't work.
Workarounds
Only way to remove the retain flag from a topic is to restart the EMQ docker container(s), but this is most probably working since I have persistence not working ...
Please advise.
Regards, Ray
A PUBLISH Packet with a RETAIN flag set to 1 and a payload containing zero bytes will be processed as normal by the Server and sent to Clients with a subscription matching the topic name.