I'm having a problem using MQTTnet library with retained message.
I use V5 protocol, qos=2
and WithCleanStart(false).WithSessionExpiryInterval(3600)
.
On the server (mosquitto) max_queued_messages = 1000 (default).
Expected and tested function (no retained message, it works as I expected):
- Subrcriber dies
- Publisher sends 2000 messages
- Subscriber up again and receive 1000 message Perfect.
With retained message on 2000 different topic (1 message per topic) This is what I have on a third-party software (mqtt explorer):
- Subrcriber dies
- Publisher sends 2000 messages on 2000 different topic (1 message per topic)
- Subscriber up again and receive 2000 message Perfect.
But with MQTTnet library on my c# program I have:
- Subrcriber dies
- Publisher sends 2000 messages on 2000 different topic (1 message per topic)
- Subscriber up again and receive 1000-1040 message Why? It seams that it's not interest if messages are retained or not..
I suppose that there is a parameters on the MQTTnet library, I checked but I'm not able to find it. Do you have any ideas?
P.S. On not dying subsriber everithing is correct:
- Publisher sends 2000 messages on 2000 different topic (1 message per topic)
- Subscriber receive 2000 message. Perfect
in This or this is suggested a server configuration, but with a different client (mqtt explorer) everithing works correctly. So I don't think is possible a server configuration. That's why a suppose a library configuration (so.. no duplicated thread).
Mqttserver Mosquitto configuration all as defaults.