espressif / esp-mqtt

ESP32 mqtt component
Apache License 2.0
603 stars 255 forks source link

Add support for getting unsent messages out of mqtt outbox (IDFGH-8355) #237

Closed bbinet closed 1 year ago

bbinet commented 2 years ago

I'm using esp-mqtt in a battery powered project, so to save energy I'm deep sleeping most of the time.

I send sensor data from time to time through mqtt, but if it takes too much time, I would like to return to deep sleep, and save the data which has not been actually sent (ack has not been received) to flash memory (NVS), so that I can try again the next time I wake up.

I couldn't find any API to get unsent data out of mqtt outbox. Can you think of any way to do it?

bbinet commented 2 years ago

Also when MQTT_EVENT_DELETED event is triggered, it would be helpful to be able to retrieve the data which has been deleted in case we want to do anything with it.

euripedesrocha commented 2 years ago

Hi @bbinet, in your case, I would suggest taking the route of writing your own outbox.

Alvin1Zhang commented 1 year ago

Thanks for reporting, would close due to short of feedback, feel free to reopen.