Backends
MQTT Message Persistence
One-to-one message Persistence
- PUB publishes a message;
- Backend records this message in DB;
- SUB subscribes to a topic;
- Backend retrieves the messages of this topic from DB;
- Messages are sent to SUB;
- Once the SUB acknowledged / received the message, backend removes the message from DB.
Many-to-many message Persistence
- PUB publishes a message;
- Backend records the message in DB;
- SUB1 and SUB2 subscribe to a topic;
- Backend retrieves the messages of this topic;
- Messages are sent to SUB1 and SUB2;
- Backend records the read position of SUB1 and SUB2, the next message’s retrieval starts from this position.
Client Connection State
EMQX supports retaining the client’s connection state in Redis or DB.
Client Subscription by Broker
EMQX Persistence supports subscription by broker. When a client goes online, the persistence module loads the subscriptions of the client from Redis or Databases.
List of Persistence Plugins
EMQX allowes storing messages in Redis, MySQL, PostgreSQL, MongoDB, Cassandra, DynamoDB, InfluxDB, OpenTSDB and Timescale:
Persistence Plugins | Config File | Description |
---|---|---|
emqx_backend_redis | emqx_backend_redis.conf | Redis Message Persistence |
emqx_backend_mysql | emqx_backend_mysql.conf | MySQL Message Persistence |
emqx_backend_pgsql | emqx_backend_pgsql.conf | PostgreSQL Message Persistence |
emqx_backend_mongo | emqx_backend_mongo.conf | MongoDB Message Persistence |
emqx_backend_cassa | emqx_backend_cassa.conf | Cassandra Message Persistence |
emqx_backend_dynamo | emqx_backend_dynamo.conf | DynamoDB Message Persistence |
emqx_backend_influxdb | emqx_backend_influxdb.conf | InfluxDB Message Persistence |
emqx_backend_opentsdb | emqx_backend_opentsdb.conf | OpenTSDB Message Persistence |
emqx_backend_timescale | emqx_backend_timescale.conf | Timescale Message Persistence |