dotnet / dotnet/MQTTnet

Retained message is not removed after expiry interval expired

Open
#1,437 6 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
C#
Stars
5.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

### 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/

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.