如何获取云到设备的待处理消息计数
How to get Cloud to Device Pending Messages Count
我正在使用 Azure 物联网中心。在 Azure 门户中,很容易看到队列中有多少云到设备消息待处理。
我想使用 C# SDK 读取这个值
var device = new Microsoft.Azure.Devices.Device("device-id");
var cloudToDeviceMessageCount = device.CloudToDeviceMessageCount;
我终于找到了工作答案如下:
using Microsoft.Azure.Devices;
RegistryManager registryManager = RegistryManager.CreateFromConnectionString("registryreadconnectionstring");
Device device = await registryManager.GetDeviceAsync("device-id");
var count = device.CloudToDeviceMessageCount;
我正在使用 Azure 物联网中心。在 Azure 门户中,很容易看到队列中有多少云到设备消息待处理。
我想使用 C# SDK 读取这个值
var device = new Microsoft.Azure.Devices.Device("device-id");
var cloudToDeviceMessageCount = device.CloudToDeviceMessageCount;
我终于找到了工作答案如下:
using Microsoft.Azure.Devices;
RegistryManager registryManager = RegistryManager.CreateFromConnectionString("registryreadconnectionstring");
Device device = await registryManager.GetDeviceAsync("device-id");
var count = device.CloudToDeviceMessageCount;