Hi Kevin,
In MQTT, the concept of message expiry is supported through the use of the "Message Expiry Interval" property. This property allows you to set a time-to-live (TTL) value for a message, specifying how long the message should be considered valid and deliverable by the MQTT broker.
When publishing a message, you can include the "Message Expiry Interval" property in the MQTT packet. The value of this property is a duration in seconds. If the message is not delivered to the intended recipient within the specified time, the MQTT broker will discard the message and it will not be delivered.
On the subscriber side, if a subscriber connects to a topic and there are messages with expired TTLs, the MQTT broker will not deliver those expired messages to the subscriber. The broker will only deliver messages that are within their TTL duration.
Since MQTT does not inherently store or retain messages beyond their TTL (if set), subscribers connecting to a topic may miss messages that were published before their connection. So that’s why MQTT may not be suitable for retrieving historical data within a defined time range.
Hope this helps. Thank You