1

更新

为了清楚起见,更新我的问题。

回购: https ://github.com/aaronprince05/IoTEdgeMes​​saging

我有 2 个模块:MessageGeneratorModule、MessageReceiverModule。

MessageGeneratorModule 发送:
批量发送 1000 条消息,然后等待 4 分钟
1 条消息/分钟,持续 2 分钟
,然后 1 条消息/秒,持续 1 分钟
,然后 20 条消息/秒,持续 1 分钟

MessageReceiverModule 是标准的 IoT Edge 模块样板代码,它只接收消息并记录它们。我已经删除了向上游发送消息的代码。

我在 IoT Edge 中有一个路由配置为

{
    "routes": {
        "myRoute": "FROM /messages/modules/messageGenerator/outputs/output INTO BrokeredEndpoint(\"/modules/messageReceiver/inputs/input1\")"
    }
}

我在这里遇到了某种类型的限制,消息似乎没有立即传递给接收者。相反,大约有 10-20 条消息被传递。下一组 10 条消息可以通过发送另一条消息来触发接收器来强制。(注意下面的时间戳)

Added Cert: /mnt/edgemodule/edge-device-ca.cert.pem
Connection String <my connection string>
IoT Hub module client initialized.
[12/19/2017 18:27:08] Received message: 1, Body: [1]
[12/19/2017 18:27:08] Received message: 2, Body: [2]
[12/19/2017 18:27:08] Received message: 3, Body: [3]
[12/19/2017 18:27:08] Received message: 4, Body: [4]
[12/19/2017 18:27:08] Received message: 5, Body: [5]
[12/19/2017 18:27:08] Received message: 6, Body: [6]
[12/19/2017 18:27:08] Received message: 7, Body: [7]
[12/19/2017 18:27:08] Received message: 8, Body: [8]
[12/19/2017 18:27:08] Received message: 9, Body: [9]
[12/19/2017 18:27:08] Received message: 10, Body: [10]
[12/19/2017 18:27:08] Received message: 11, Body: [11]
[12/19/2017 18:27:08] Received message: 12, Body: [12]
[12/19/2017 18:27:08] Received message: 13, Body: [13]
[12/19/2017 18:27:08] Received message: 14, Body: [14]
[12/19/2017 18:27:08] Received message: 15, Body: [15]
[12/19/2017 18:27:08] Received message: 16, Body: [16]
[12/19/2017 18:27:08] Received message: 17, Body: [17]
[12/19/2017 18:27:08] Received message: 18, Body: [18]
[12/19/2017 18:27:08] Received message: 19, Body: [19]
[12/19/2017 18:27:08] Received message: 20, Body: [20]
[12/19/2017 18:27:08] Received message: 21, Body: [21]
[12/19/2017 18:30:59] Received message: 22, Body: [22]
[12/19/2017 18:30:59] Received message: 23, Body: [23]
[12/19/2017 18:30:59] Received message: 24, Body: [24]
[12/19/2017 18:30:59] Received message: 25, Body: [25]
[12/19/2017 18:30:59] Received message: 26, Body: [26]
[12/19/2017 18:30:59] Received message: 27, Body: [27]
[12/19/2017 18:30:59] Received message: 28, Body: [28]
[12/19/2017 18:30:59] Received message: 29, Body: [29]
[12/19/2017 18:30:59] Received message: 30, Body: [30]
[12/19/2017 18:30:59] Received message: 31, Body: [31]
[12/19/2017 18:31:59] Received message: 32, Body: [32]
[12/19/2017 18:31:59] Received message: 33, Body: [33]
[12/19/2017 18:31:59] Received message: 34, Body: [34]

其余的日志可以在 repo 中找到。您应该能够拉下代码并运行它以查看异常情况。

4

2 回答 2

2

非常感谢您报告此事。您发布的代码对调查问题有很大帮助。你是对的,这是一个错误。所以,我已经在 GitHub 上打开了这个问题,所以你知道它什么时候修复: https ://github.com/Azure/iot-edge/issues/455

基本上,Edge Hub 一次接收大量消息时会出现问题。因此,作为一种解决方法,如果您想发送 1000 条消息,而不是发送一批 1000 条,而是发送多批 10 条。

这只是暂时的,直到我们解决这个问题。

[更新] 项目在 1.0.0-preview019 版本中修复。

于 2018-01-03T23:44:31.583 回答
0

我不确定_module来自哪里?我的模块 - 源自官方示例,在 MessageHandler 方法中使用 DeviceClient 像这样:

DeviceClient deviceClient = (DeviceClient)userContext;
// Build your message
//...
await deviceClient.SendEventAsync("output1", identifiedMessage);

这对你有用吗?

于 2017-12-18T16:55:17.580 回答