简体   繁体   English

如何在不使用IoT中心的情况下从IoT Edge Hub检索消息

[英]How to retrieve messages from IoT Edge Hub without using IoT Hub

I want to write a C# application which gets messages out of an IoT Edge hub on an IoT Edge device before they are sent to the IoT Hub. 我想编写一个C#应用程序,以将消息从IoT Edge设备上的IoT Edge 集线器中取出,然后再将其发送到IoT集线器。

I want to write an end-to-end test for my IoT edge modules. 我想为我的IoT边缘模块编写一个端到端测试。 To do this, I'm going to run the whole IoT edge runtime as well as an MQTT server within a Docker container. 为此,我将在Docker容器中运行整个IoT Edge运行时以及MQTT服务器。 I then want to write a test which sends data to the MQTT server from outside the container and retrieves them back by connecting directly to the IoT edge hub. 然后,我想编写一个测试,该测试将数据从容器外部发送到MQTT服务器,并通过直接连接到IoT Edge集线器将其检索回来。

My initial architecture looks like this: 我的初始架构如下所示:

在此处输入图片说明

But I want to have something like this: 但是我想要这样的东西:

在此处输入图片说明

I still need the IoT hub to create devices on the edge, but I want to listen directly to the edge hub to retrieve messages out of my pipeline. 我仍然需要IoT中心在边缘上创建设备,但我想直接收听边缘中心以从管道中检索消息。

I could write a "test module" which does my test within the container, but that's actually not what I want to do. 可以编写一个“测试模块”在容器中进行测试,但这实际上不是我想要做的。

So my questions are: 所以我的问题是:

  1. Is this actually possible to do? 这实际上可行吗?
  2. Where can I get information on how to connect directly to IoT Edge hub? 在哪里可以获得有关如何直接连接到IoT Edge集线器的信息?

The Edge hub does not have an endpoint to consume messages from the outside like the IoT Hub does. Edge集线器没有像IoT集线器那样具有终结点来消费来自外部的消息。 So your only solution here would be to have another custom module that you route your messages into. 因此,您唯一的解决方案是将您的消息路由到另一个自定义模块。 This module then can expose an endpoint where it would provide the incoming messages to an outside system. 然后,此模块可以公开一个端点,在该端点它将向外部系统提供传入消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM