Skip to content

Commit 294a6f2

Browse files
Merge pull request #301917 from jlian/patch-947047
Add detail about max message expiry and retained messages
2 parents 9a8dec2 + f80c629 commit 294a6f2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

articles/iot-operations/manage-mqtt-broker/howto-broker-mqtt-client-options.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: patricka
66
ms.topic: how-to
77
ms.service: azure-iot-operations
88
ms.subservice: azure-mqtt-broker
9-
ms.date: 11/11/2024
9+
ms.date: 06/26/2025
1010

1111
#CustomerIntent: As an operator, I want to configure an MQTT broker so that I can control MQTT client interactions.
1212
---
@@ -82,7 +82,15 @@ The `maxSessionExpirySeconds` setting works with the subscriber queue limit to e
8282

8383
Both message expiry and session expiry are important for managing slow and offline subscribers and ensuring efficient memory usage.
8484

85+
## Max message expiry and retained Messages
86+
87+
In MQTT 5, retained messages respect the message expiry interval specified in the `PUBLISH` packet. If an expiry interval is set, the retained message is removed once the interval elapses. If no interval is provided, the message remains available indefinitely.
88+
89+
The `maxMessageExpirySeconds` setting defines a global upper limit for message expiry, applying to all messages, including retained ones. For example, if `maxMessageExpirySeconds` is set to `1000` seconds and a retained message specifies an expiry interval of `2000` seconds, the message is still removed after `1000` seconds.
90+
91+
By default, `maxMessageExpirySeconds` is not set. In this case, retained messages do not expire unless an expiry interval is explicitly defined in the message.
92+
8593
## Related content
8694

8795
- [Configure listeners for the MQTT broker](./howto-configure-brokerlistener.md)
88-
- [Test connectivity to the MQTT broker](./howto-test-connection.md)
96+
- [Test connectivity to the MQTT broker](./howto-test-connection.md)

0 commit comments

Comments
 (0)