question

mpoeckl avatar image
0 Votes"
mpoeckl asked AshokPeddakotla-MSFT commented

IoT Edge module routing

Is it possible to route an output of an edge module into the input of the very same module (loop a message into the same module)?

azure-iot-edge
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

anonymous user
Not sure about the same module. If you are testing the loop, then please check Azure IoT Edge - End2End testing loop and see if it helps.


0 Votes 0 ·

1 Answer

SandervandeVelde42 avatar image
6 Votes"
SandervandeVelde42 answered AshokPeddakotla-MSFT commented

Let's do an experiment.

I created this VM running iot edge. I added the svelde/iot-edge-echo:2.0.1-amd64 module with an input and an output (what is coming in, is also send out):

20187-image.png


I added this route:

FROM /messages/modules/echo/outputs/output1 INTO BrokeredEndpoint("/modules/echo/inputs/input1")

So the outcoming echo module messages go into the echo module.

Please do accept helpful posts as accepted answer so that it can help others within the community with similar issues.

Now I only have to send one message to the echo module. We do this with the svelde/iot-edge-one-message:0.0.1-amd64 module.

This 'one' module sends one message to 'output1' on restart of the module.

So I added to modules, the 'one' module and the 'echo' module and this extra route:

FROM /messages/modules/one/outputs/output1 INTO BrokeredEndpoint("/modules/echo/inputs/input1")

I now restart the 'one module'.

20225-image.png

The message is sent after the restart.

The message arrives at the echo module:

20226-image.png

But I see no actual resend of the same message over and over. So it seems the routing is limited to only other modules.

To prove this, I added a second echo module.

So the routing goes:

FROM /messages/modules/one/outputs/output1 INTO BrokeredEndpoint("/modules/echo/inputs/input1")
FROM /messages/modules/echo/outputs/output1 INTO BrokeredEndpoint("/modules/echo2/inputs/input1")
FROM /messages/modules/echo2/outputs/output1 INTO BrokeredEndpoint("/modules/echo/inputs/input1")

This time we see the infinite loop:

20208-image.png

Conclusion: Routing is protected against sending a message to itself. But you can fool it by putting a (the same) module in between.









image.png (105.1 KiB)
image.png (11.8 KiB)
image.png (7.3 KiB)
image.png (63.7 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Please do accept helpful posts as an accepted answer so that it can help others within the community with similar issues.

1 Vote 1 ·

Hi,

I am trying to test module ot module routing in my device. however it is not working. here are the modules and the routes. i am not getting anythign except the output from sensor to iothub.
135422-image.png
FROM /messages/modules/SimulatedTemperatureSensor/outputs/* INTO BrokeredEndpoint("/modules/EchoonIoTEdge/inputs/Input1")
This is the entry in my route.
i also have the output route. in fact the output to asajob is also not working. is there somethign wrong with my setup? i enabled runtimeloglevel to verbose and can see messages are sent. can u suggest something?

135404-image.png


0 Votes 0 ·
image.png (28.6 KiB)
image.png (216.7 KiB)

@kaushikroy-7024 Your query is addressed here : https://docs.microsoft.com/en-us/answers/questions/566885/i-am-not-able-to-communicate-between-modules-on-io.html
Hope your issue is resolved now. Feel free to reach out if if you have any other queries.

0 Votes 0 ·