java - Microsoft Azure IoT 中心 (java) 发送消息后通知 "Lost connection to the server. Reconnecting 0 time."

标签 java azure azure-iot-hub azure-iot-sdk

我使用 IoT 中心 Java 库在我的设备和 Microsoft Azure 之间发送消息。

要连接,我打电话

client = new DeviceClient(connString, protocol);
client.open();

然后,发送一条消息,我打电话

client.sendEventAsync(message, callback, lockobj);

然后,发送消息时会调用我的回调函数。

但是,问题在于,在我的终端上调用 sendEventAsync 后,无限地出现消息与服务器的连接丢失。重新连接 0 次。

我尝试在发送消息后关闭连接并每次重新打开它,但我认为这是最糟糕的,问题仍然存在。而且,我执行了Azure(https://github.com/Azure-Samples/azure-iot-samples-java/archive/master.zip)给出的测试样本,也遇到了同样的问题。

所以我的问题是,该库是否存在问题(因为即使其代码也存在问题)?还是我做错了什么?

非常感谢!

最佳答案

我发现了问题:今天我测试了与昨天相同的代码,一切正常。所以我登录了Azure,发现了这个错误消息:

There was an error querying devices: Forbidden:{ "Message": "ErrorCode:IotHubQuotaExceeded;Total number of messages on IotHub '[..]' exceeded the allocated quota. Max allowed message count : '8000', current message count : '20107'. Send and Receive operations are blocked for this hub until the next UTC day. Consider increasing the units for this hub to increase the quota.", "ExceptionMessage": "Tracking ID:[..]-TimeStamp:10/17/2018 08:48:37" }.

所以,问题是我超出了消息配额。然而,昨天我很困惑,因为 Azure 回复了我消息“OK_EMPTY”,这意味着一切都好......

关于java - Microsoft Azure IoT 中心 (java) 发送消息后通知 "Lost connection to the server. Reconnecting 0 time.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52839637/

相关文章:

node.js - 如何检查 Azure IOT 中心发送器是否已停止使用 node.js 和 socket.io

azure - 使用/New-AzureRm Iot Hub创建Azure IOT Hub

java - 使用 JDBC 更新多行

java - 如何让 Maven 接受无效的 SSL 证书?

c# - 无论我做什么,TimerTrigger Azure Functions 都无法工作

asp.net - Azure Service Fabric 与 Docker 做同样的事情吗?

python - 如何返回 API 响应并同时使程序失败?

java - 使用 "Microsoft Print to PDF"和 Java 将文档转换为 PDF

java - 如何在android中移动 ImageView

java - 如何使用 azure 设备身份 REST?