消息未在边缘模块之间路由

Messages not being routed between Edge modules

更新

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

回购: https://github.com/aaronprince05/IoTEdgeMessaging

我有 2 个模块:MessageGeneratorModule、MessageReceiverModule。

MessageGeneratorModule 发送:
一批1000条消息,然后等待4分钟
1 message/minute 2 分钟
然后1message/second 1分钟
然后 20 messages/second 1 分钟

MessageReceiverModule 是标准的物联网边缘模块样板代码,它只接收消息并记录它们。我删除了向上游发送消息的代码。

我在 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 中找到。您应该能够下拉代码并 运行 它以查看异常情况。

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

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

这对你有用吗?

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

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

这只是暂时的,直到我们填补这个问题。

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