1

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.

I want to write an end-to-end test for my IoT edge modules. To do this, I'm going to run the whole IoT edge runtime as well as an MQTT server within a Docker container. 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.

My initial architecture looks like this:

enter image description here

But I want to have something like this:

enter image description here

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.

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?
ilkerkaran
  • 4,214
  • 3
  • 27
  • 42
Tobias von Falkenhayn
  • 1,355
  • 5
  • 26
  • 59
  • A couple of questions: 1) Why does your "C# Test" create a device in IoT Hub? 2) Why do you need a MQTT server in a module? Can't your "C# Test" send messages directly to Edge hub (as a leaf IoT device)? 3) What do you actually want to test? :) – silent Apr 30 '19 at 12:33
  • 1) Because I want to do dynamic device creation in my test, e.g. set up device, test it, remove it 2) MWTT server is not in a module, its just in the same docker container than the IoT Edge runtime 3) I just want to test the whole "Edge" side of the IoT (whole module pipeline) in a e2e fashion – Tobias von Falkenhayn Apr 30 '19 at 13:33
  • ok, so your test device is actually connecting to the MQTT endpoint of the Edge Hub?! Your picture is a bit misleading in this regard. I assume your "Edge module" is doing some sort of aggregation then? – silent Apr 30 '19 at 14:16
  • yes, my testcode is sending data to the mqtt server which actually sends it to the edge runtime. then a chain of modules is transforming the data. I then want to get the data back but not going over the iot hub. – Tobias von Falkenhayn Apr 30 '19 at 17:45
  • Ok got it. See my answer below – silent Apr 30 '19 at 17:57

1 Answers1

4

The Edge hub does not have an endpoint to consume messages from the outside like the IoT Hub does. 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.

silent
  • 14,494
  • 4
  • 46
  • 86
  • just curious, but is there an official page saying it doesn't have an endpoint? I couldn't find anything about that. Thank you anyway :) – Tobias von Falkenhayn May 01 '19 at 05:13
  • I haven’t seen anything that says it’s possible ;) but feel free to look in the source code and see if there’s maybe a hidden “back door” :) – silent May 01 '19 at 10:15
  • 1
    Sorry for hijacking the original question but is it possible to use an Azure IoT Edge device as a generic gateway to push data to different clouds like AWS, Google etc? – abdus_salam Aug 25 '20 at 22:34