gpt4 book ai didi

java - Paho Java - 文件持久性

转载 作者:太空宇宙 更新时间:2023-11-04 11:42:05 30 4
gpt4 key购买 nike

我最近开始使用 paho mqtt for java 和 mqtt,但我坚持使用 mqtt 代理和 paho 客户端本身提供的持久性机制。也许我误解了(可能就是这样)mqtt 上下文中的持久性概念。

我们必须支持的用例如下:我们的 mqtt 客户端有可能已断开连接 7 天(我非常怀疑这种情况是否会发生,但没关系),甚至应用程序在这 7 天内关闭而没有恢复连接,一旦它启动并运行,就会在断开连接期间发送所有 7 天的所有消息。

Paho 客户端支持在其或代理关闭时持久保存缓冲消息,一旦网络恢复或代理启动,就会发送缓冲消息,但如果应用程序在客户端断开连接或代理不可用时关闭,则无法发送缓冲消息。

基本上我的问题是 - 断开连接的缓冲消息是否有可能在泛美卫生组织客户端关闭并重新启动后继续存在?

最佳答案

该规范对此没有任何说明,仅指定:

A retained message is a normal MQTT message with the retained flag set to true. The broker will store the last retained message and the corresponding QoS for that topic Each client that subscribes to a topic pattern, which matches the topic of the retained message, will receive the message immediately after subscribing. For each topic only one retained message will be stored by the broker.

如您所见,您的客户只会收到该主题的最后发布的消息...

后面的一切都恢复了!

关于java - Paho Java - 文件持久性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42698732/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com