python - 无法在 Azure Edge 中执行模块到模块的通信
问题描述
我试图在 Azure 边缘实现从 c# 模块到 python 模块的模块到模块通信,
Using Ubuntu as OS
Edge Runtime: 1.0.8
EdgeAgent 1.0.10
EdgeHub 1.0.10
发送数据的 C# 代码
{
Console.WriteLine($"Received message: [{cloudtoDeviceMessages}]"); // cloudtoDeviceMessages is a string
await moduleClient.SendEventAsync("serialmoduleoutput", new Message(Encoding.UTF8.GetBytes(cloudtoDeviceMessages)));
Console.WriteLine("Sent The Method Body To Serial Module");
部署文件中的路由,我也有其他模块路由,但只给出相关的
Fromc2dcommunicationmoduleToTestModule": "FROM /messages/modules/c2dcommunicationmodule/outputs/serialmoduleoutput INTO BrokeredEndpoint(\"/modules/TestModule/inputs/input1\")",
Python 代码:与此 GitHub 示例相同https://github.com/Azure/azure-iot-sdk-python/blob/master/azure-iot-device/samples/sync-samples/receive_message_on_input.py
在 C# 代码中我没有得到任何异常,但是在 python 模块中我也没有得到任何数据。
解决方案
该问题已通过更新 require.txt 文件中的 azure-iot-device 包得到解决,默认情况下,在创建模块时它会安装 2.0.0 版本的包,但最新版本是 2.8。在最新版本中,通信工作正常。
推荐阅读
- jquery - 位置方法而不是 jquery 事件中的选择器
- python - AttributeError:“列表”对象没有属性“值”-用于 Azure DevOps 的 Python API
- sql - 如何在另一台服务器中获取存储过程的实际脚本?
- xml - 使用 XSL 转换合并两个 XML 文件
- node.js - 告诉 Typedoc 不要加载 Jasmine 注释
- javascript - Grave (`) 被标记为非法令牌
- elasticsearch - 如何在elasticsearch中保存地理数据
- excel - InputBox 数据验证和结束循环
- tinybutstrong - 使用 TBS 准备好的报表
- jestjs - 如何开玩笑地将测试中的数据传递给记者?