I have tried to test the routing messages from temp sensor module to a custom CModule following the tutorial "Develop a C IoT Edge module using Linux containers"
.My environment is Raspberry PI 4B arm32v7 .Trying to achieve a flow as -Sensor module -> Cmodule ->to upstream(to view in explorer).My goal is building a heartbeat and filter/analytics module for a set of sensors connected to my edge device.verified modules are up and running and can see custom logs from loop inside iothub_module() after InitializeConnection() of my module.By that I believe there is no runtime error .my routes are as
edgesolutionToIoTHub FROM /messages/modules/SampleModule/outputs/* INTO $upstream
SimulatedTemperatureSensorToedgesolution FROM /messages/modules/SimulatedTemperatureSensor/outputs/temperatureOutput INTO BrokeredEndpoint("/modules/SampleModule/inputs/input1")
I would like to request for a support with a correct approach to achieve routing.
Yes, the JSON in the deployment manifest (on the review page) shows these escape characters.
Hello
@samkris
,
in the routing, you are sending messages to a module named 'SampleModule':
"/modules/SampleModule/inputs/input1"
It seems you actually named that module 'edgesolution'.
"/modules/edgesolution/inputs/input1"
Additionally, if your modules keep running without errors (see the module log for confirmation) this routing is the actual problem. Check it twice :-)
Thanks
@Sander van de Velde
I have noticed it the name difference later and corrected it and following is my routes now.
"$edgeHub": {
"properties.desired": {
"routes": {
"edgesolutionToIoTHub": "FROM /messages/modules/edgesolution/outputs/INTO $upstream",
"SimulatedTemperatureSensorToedgesolution": "FROM /messages/modules/SimulatedTemperatureSensor/outputs/temperatureOutput INTO BrokeredEndpoint(\\"/modules/edgesolution/inputs/input1\\")"
"schemaVersion": "1.0",
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
Ican see error logs from module on runtime as below. Connectivity is fine.
Error: Time:Mon Jun 28 06:33:22 2021 File:/build/azure-iot-sdk-c-PMWlQ1/azure-iot-sdk-c-0.2.0.0/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2521 failure connecting to address raspberrypi.
Error: Time:Mon Jun 28 06:33:24 2021 File:/build/azure-c-shared-util-GUqJKr/azure-c-shared-util-0.2.0.0/adapters/socketio_berkeley.c Func:wait_for_connection Line:431 Failure: connect failure 111.
Error: Time:Mon Jun 28 06:33:24 2021 File:/build/azure-c-shared-util-GUqJKr/azure-c-shared-util-0.2.0.0/adapters/socketio_berkeley.c Func:socketio_open Line:833 wait_for_connection failed
Error: Time:Mon Jun 28 06:33:24 2021 File:/build/azure-umqtt-c-wme5KW/azure-umqtt-c-0.2.0.0/src/mqtt_client.c Func:onOpenComplete Line:454 Error: failure opening connection to endpoint
Error: Time:Mon Jun 28 06:33:24 2021 File:/build/azure-c-shared-util-GUqJKr/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:839 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Mon Jun 28 06:33:24 2021 File:/build/azure-c-shared-util-GUqJKr/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1426 Failed opening the underlying I/O.
Error: Time:Mon Jun 28 06:33:24 2021 File:/build/azure-umqtt-c-wme5KW/azure-umqtt-c-0.2.0.0/src/mqtt_client.c Func:mqtt_client_connect Line:1093 Error: io_open failed
Thanks,
Hello
@samkris
,
It's not clear to me what the source of these error messages are.
I see these strange THREE escape characters of the " :
BrokeredEndpoint(\\"/modules/edgesolution/inputs/input1\\")"
In the deployment manifest, this should look like:
BrokeredEndpoint(\"/modules/edgesolution/inputs/input1\")"
(just one \ per ")
If you enter/update these routes in the Azure portal wizard, please leave out the escape characters.
Please test the routing part from the actual module logic. You can use eg.
https://github.com/iot-edge-foundation/iot-edge-echo
to echo the generated messages. If this works, you can focus on your module logic.
Hi
@Sander van de Velde
,
Its started working with following routes.
sensorToedgesolution : FROM /messages/modules/sensor/outputs/* INTO BrokeredEndpoint("/modules/edgesolution/inputs/input1")
edgesolutionToIoTHub :FROM /messages/modules/edgesolution/outputs/* INTO $upstream
Still I have this at the beginning .
ort_mqtt_common.c Func:SendMqttConnectMsg Line:2521 failure connecting to address raspberrypi.
Error: Time:Mon Jun 28 15:19:15 2021 File:/build/azure-c-shared-util-GUqJKr/azure-c-shared-util-0.2.0.0/adapters/socketio_berkeley.c Func:wait_for_connection Line:431 Failure: connect failure 111.
Error: Time:Mon Jun 28 15:19:15 2021 File:/build/azure-c-shared-util-GUqJKr/azure-c-shared-util-0.2.0.0/adapters/socketio_berkeley.c Func:socketio_open Line:833 wait_for_connection failed
Error: Time:Mon Jun 28 15:19:15 2021 File:/build/azure-umqtt-c-wme5KW/azure-umqtt-c-0.2.0.0/src/mqtt_client.c Func:onOpenComplete Line:454 Error: failure opening connection to endpoint
Error: Time:Mon Jun 28 15:19:15 2021 File:/build/azure-c-shared-util-GUqJKr/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:839 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Mon Jun 28 15:19:15 2021 File:/build/azure-c-shared-util-GUqJKr/azure-c-shared-util-0.2.0.0/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1426 Failed opening the underlying I/O.
Error: Time:Mon Jun 28 15:19:15 2021 File:/build/azure-umqtt-c-wme5KW/azure-umqtt-c-0.2.0.0/src/mqtt_client.c Func:mqtt_client_connect Line:1093 Error: io_open failed
Error: Time:Mon Jun 28 15:19:15 2021 File:/build/azure-iot-sdk-c-PMWlQ1/azure-iot-sdk-c-0.2.0.0/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2521 failure connecting to address raspberrypi.
Please help me to understand why is this,Is this an expected behaviour?What can I do to avoid this?
Thanks,