MQTTnet
MQTTnet copied to clipboard
Retained message is not removed after expiry interval expired
Describe the bug
When publishing on a topic using the .WithRetainFlag(true) option and setting the MessageExpiryInterval to x seconds the message is pushed to the server. There it stays in the topic until it gets overwritten with a new message or it will be removed because a new message is send without any payload. According to the documentation the message should be deleted from the topic after the x seconds specified in the publish call which is not the case.
To make sure it was not client related I used the mosquitto test Server to verify, and indeed there the message was removed after the x seconds passed.
Which component is your bug related to?
- Server
To Reproduce
Steps to reproduce the behavior: Using this version of MQTTnet '4.0.1.184'. and select version 5 of MQTT. Create a simple version of the Server using the MQTTnet nuget Create a simple version of an publishing client using MQTTnet that publish a message using the above mentioned flags Create a simple version of an subscribing client using MQTTnet As a alternative the Mosquitto_pub and Mosquitto_sub commandline tools can be used as clients.
Expected behavior
the message will be removed from the topic after the x seconds are passed as described in the documentation here: https://www.hivemq.com/blog/mqtt5-essentials-part4-session-and-message-expiry/
According to "https://github.com/dotnet/MQTTnet/wiki/MQTT-Version-5-Features" This is not yet supported. It is planned but not yet started.
That is a shame, I missed that part in the wiki. Is there an expected delivery date for it?
Currently stabilizing version 4.0 by fixing issues has priority. After that new features will be added with version 4.1. The expiry of retained messages is quite simple to implement so that I assume it will be implemented within 1-3 month. Hope this helps.
@chkr1011 What is the status here?
Hi @chkr1011,
Is there any good news?
No update here. We are still working on making the retained messages manager a component which can be replaced with other implementations. This also raises the question which component is now responsible for cleaning up the retained messages. I will let you know when there are updates.