esp-mqtt icon indicating copy to clipboard operation
esp-mqtt copied to clipboard

MQTT data persistence (QOS 1 and 2) (IDFGH-12616)

Open Teesmo opened this issue 10 months ago • 1 comments

From the documentation,and after perusing through some of code, I gather that MQTT enqueues QOS level 1 and 2 messages (regardless of whether the persistence handler is enabled or not). My question is, where is this persisted data stored? Is it stored in RAM or in Flash? Will it exist (still be enqueued) if my device powers down?

Teesmo avatar Apr 15 '24 15:04 Teesmo

Data is stored in RAM, if you want to have some persistence to flash you can implement a custom outbox. We have an example showing usage of C++ allocators. You can use it to see the changes needed in the configuration and how to set the build.

euripedesrocha avatar Apr 16 '24 05:04 euripedesrocha

@euripedesrocha Would you advise I implement a custom outbox in rtc fast memory?

Teesmo avatar Jun 06 '24 16:06 Teesmo

@Teesmo it will depend on your application and message types. From the mqtt client code it is possible and at first glance it could be a simple change from our current outbox implementation. You would need to change the allocations in this function. You need to pay attention to other factors like the core that can access the memory you select and the available size to use.

euripedesrocha avatar Jun 07 '24 09:06 euripedesrocha