moscajs / aedes-cli

Run Aedes MQTT Broker from the CLI
MIT License
53 stars 19 forks source link

[question] How does persistence works in Aedes? #85

Closed mushroomwithegg closed 3 years ago

mushroomwithegg commented 3 years ago

If I publish a message with QoS of >1 without any subscriber at first, will it store the messages in the broker? And after publishing the message, then I subscribed in the same topic, will I get all the messages published?

robertsLando commented 3 years ago

Persistence stores all incoming outgoing qos > 0 messages (because if qos is grater then 1 they have to wait to receive a puback/pubcomp), subscriptions and retained messages. In your case you maybe want to use retained messages, when a retained message is sent to broker to a specific topic the broker will store it in persistence and send it back to clients when they subscribe to a topic (or a wildecard) that matches that retained message topic (and any others matches)

mushroomwithegg commented 3 years ago

I checked retained messages and it's only store 1 message at a time right?

robertsLando commented 3 years ago

@iwillflytothemoon The last received message of each topic, yes. If you need an historical storage checkout influxdb (timeseries database) telegraf (with mqtt integration to store mqtt messages) and also grafana (for visualization)