MessageExpiryInterval

Hi…

I managed to build an application establishing the MQTT5 request/response pattern.
This works properly …
I am now trying to add some error handling.
When I use the parameter MessageExpiryInterval in the PublishAsync call and the backend/responder is not available, I understand that the broker is “deleting” the published message after the timeout.
Is there any method that the broker informs the requesting client that timeout happened (indicating that request did not receive response in given time) ?
Thanks in advance

Hi @stevy

Hi, and a warm welcome to the HiveMQ Community! We’re excited that you’re interested in MQTT and the HiveMQ broker. Your presence adds value to our community.

No, the MQTT specification does not include any mechanism for the broker to notify the publisher when the MessageExpiryInterval of a published message has expired.

When a message expires after the specified interval without being delivered, the broker simply discards the message, and this event is not communicated back to the publisher or any other clients.

If you need to handle such situations, you will have to implement a timeout mechanism on the publisher’s side to manage and respond to potential message expirations. This could involve setting a timer after sending a message and implementing error handling if a response isn’t received in the expected timeframe.

I hope this helps
Best,
Dasha from The HiveMQ Team

Thanks a lot for your answer !!!