published message store by mosquitto broker when s

2019-05-23 06:54发布

问题:

My both publisher and subscriber are both connected to mosquitto (paho) broker with QOS=2 and maintaining persistent session by clean_session=false. When i publish message with subscriber connected to broker, it successfully received by subscriber, now if I disconnect the subscriber , then again publish message and connect subscriber after, I will be able to retrieve message those messages when my subscriber was offline.

My question is --

  1. Is there any storage in the broker which stores all the messages when subscriber is offline.

  2. If yes, how much long or how many message it can store.

  3. Is this approach is good for real time GPS tracking where subscriber can go offline for a long time (5-6 hr) approx.

  4. Is session persistence is maintained even if power goes off.

  5. How much traffic it can handle for scalable application if I use this approach in real time gps tracking..

回答1:

  1. Yes, there is a file (mosquitto.db). You can control where this file is written to disk in the mosquitto.conf file autosave* and persistence* options

  2. Messages are stored as long as there are persistence sessions and the limit is disk space (or possibly 2-4gb for 32bit mosquitto). But either way that is a LOT of messages (unless you have stupidly large messages)

  3. It depends on you message rates and the number of publishers/subscribers

  4. Yes session persistence is kept in the same db file so state is maintained over mosquitto restarts

  5. Again this really depends on how many publishers/subscribers you have and what the message rates are.