codepr/sol

Add persistence cronjob

Opened this issue · 2 comments

Design and implement an efficient persistence layer to be run as a cron routine for client sessions with clean_session set to false.

  • Sqlite3 backend DB, demand all heavy lifting to it
  • Dump memory on disk by using some convenient data structure (e.g. B-Tree etc..)

First, nice project! Some questions:

will the same persistence layer be used for retained messages?
with possible different backends?

I am asking because some time ago I wanted to make use of retained messages of mosquitto in a low power embedded linux device. But the way mosquitto's persistence is implemented.... it is not optimal. While they provide auth plugin interface, such thing is missing for persistence.

Thank you! Development has been a bit discontinuous lately, I'm still not sure of the best approach for persistence, I'll probably go incremental by starting with the simplest solution, like raw binary dumping of messages, including retained ones on disk for clients with clean_session=false. The entire stream will then be re-read at startup to resume the previous state, but yeah, different backends like redis or some DBs could be a future improvement.
Doesn't mosquitto allow to store retained messages on Redis? It should be a reasonably lightweight solution