Backends

WARNING

Data storage is an exclusive feature of EMQ X Enterprise.

MQTT Message Persistence

One-to-one message Persistence

image

  1. PUB publishes a message;
  2. Backend records this message in DB;
  3. SUB subscribes to a topic;
  4. Backend retrieves the messages of this topic from DB;
  5. Messages are sent to SUB;
  6. Once the SUB acknowledged / received the message, backend removes the message from DB.

Many-to-many message Persistence

image

  1. PUB publishes a message;
  2. Backend records the message in DB;
  3. SUB1 and SUB2 subscribe to a topic;
  4. Backend retrieves the messages of this topic;
  5. Messages are sent to SUB1 and SUB2;
  6. Backend records the read position of SUB1 and SUB2, the next message’s retrieval starts from this position.

Client Connection State

EMQ X supports retaining the client’s connection state in Redis or DB.

Client Subscription by Broker

EMQ X 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

EMQ X allowes storing messages in Redis, MySQL, PostgreSQL, MongoDB, Cassandra, DynamoDB, InfluxDB, OpenTSDB and Timescale:

Persistence PluginsConfig FileDescription
emqx_backend_redisemqx_backend_redis.confRedis Message Persistence
emqx_backend_mysqlemqx_backend_mysql.confMySQL Message Persistence
emqx_backend_pgsqlemqx_backend_pgsql.confPostgreSQL Message Persistence
emqx_backend_mongoemqx_backend_mongo.confMongoDB Message Persistence
emqx_backend_cassaemqx_backend_cassa.confCassandra Message Persistence
emqx_backend_dynamoemqx_backend_dynamo.confDynamoDB Message Persistence
emqx_backend_influxdbemqx_backend_influxdb.confInfluxDB Message Persistence
emqx_backend_opentsdbemqx_backend_opentsdb.confOpenTSDB Message Persistence
emqx_backend_timescaleemqx_backend_timescale.confTimescale Message Persistence