消息未在Edge模块之间路由

时间:2017-12-18 16:12:11

标签: c# azure-iot-edge

更新

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

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

我有2个模块:MessageGeneratorModule,MessageReceiverModule。

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

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

我在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]

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

2 个答案:

答案 0 :(得分:2)

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

基本上,Edge Hub在同时接收大批邮件时会出现问题。所以,作为一种解决方法,如果你想发送1000条消息,而不是发送一批1000条消息,则发送多批10条消息。

这只是暂时的,直到我们填写此问题。

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

答案 1 :(得分:0)

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

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

这对你有用吗?