当订户以QOS = 2脱机时,由mosquitto代理发布的消息存储 [英] published message store by mosquitto broker when subscriber is offline with QOS=2
问题描述
我的发布者和订阅者都以QOS = 2的身份连接到mosquitto(paho)代理,并通过clean_session = false维护持久会话.当我与连接到代理的订户发布消息时,订户成功接收到该消息,现在,如果我断开订户的连接,然后再次发布消息并与订户建立连接,那么当我的订户处于脱机状态时,我将能够检索到那些消息.
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.
我的问题是-
-
代理中是否有任何存储,可以在订户脱机时存储所有消息.
Is there any storage in the broker which stores all the messages when subscriber is offline.
如果是,则可以存储多长时间或多条消息.
If yes, how much long or how many message it can store.
这种方法是否适合实时GPS跟踪,使订户可以长时间(约5-6小时)下线.
Is this approach is good for real time GPS tracking where subscriber can go offline for a long time (5-6 hr) approx.
即使断电也可以保持会话持久性.
Is session persistence is maintained even if power goes off.
如果我在实时gps跟踪中使用此方法,它可以为可伸缩应用程序处理多少流量.
How much traffic it can handle for scalable application if I use this approach in real time gps tracking..
推荐答案
-
是的,有一个文件(mosquitto.db).您可以在 mosquitto.conf 文件和
persistence*
选项
只要存在持久性会话且消息的限制为磁盘空间(对于32位mosquitto,可能为2-4gb),消息就被存储.但是,无论哪种方式,都会产生大量消息(除非您收到的消息非常笨拙)
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)
这取决于您的留言率和发布者/订阅者的数量
It depends on you message rates and the number of publishers/subscribers
是的,会话持久性被保存在同一个db文件中,因此在mosquit重启后保持状态
Yes session persistence is kept in the same db file so state is maintained over mosquitto restarts
这实际上取决于您拥有多少个发布者/订户以及邮件率是什么.
Again this really depends on how many publishers/subscribers you have and what the message rates are.
这篇关于当订户以QOS = 2脱机时,由mosquitto代理发布的消息存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!