0
votes

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?
1
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
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 fashionTobias von Falkenhayn
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
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
Ok got it. See my answer belowsilent

1 Answers

4
votes

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.