question

samkris-5887 avatar image
0 Votes"
samkris-5887 asked obloch answered

Edge module multiple inputs

I have an IoT Edge Module in C which I am trying to make to act as a filter module with multiple inputs .I have followed default c module and created a module with "input1" and route set accordingly.
As a trial modified "input1"to "input2",and set route as below.
code:
IoTHubModuleClient_LL_SetInputMessageCallback(iotHubModuleClientHandle, "input2", InputQueue2Callback, (void*)iotHubModuleClientHandle)
route:
Route:
sensormoduleTofiltermodule:FROM /messages/modules/sensormodule/outputs/* INTO BrokeredEndpoint("/modules/filtermodule/inputs/input2")


Ihave following errors from filtermodule, which I couldnot resolve.


Error: Time:Wed Jul 21 15:30:12 2021 File:/build/azure-iot-sdk-c-PMWlQ1/azure-iot-sdk-c-0.2.0.0/iothub_client/src/iothubtransport_mqtt_common.c Func:processIncomingMessageNotification Line:1766 IoTHubClientCore_LL_MessageCallbackreturned false
Error: Time:Wed Jul 21 15:30:13 2021 File:/build/azure-iot-sdk-c-PMWlQ1/azure-iot-sdk-c-0.2.0.0/iothub_client/src/iothub_client_core_ll.c Func:IoTHubClientCore_LL_MessageCallbackFromInput Line:674 Could not find callback (explicit or default) for input queue input2


I would like to knowwhether it is possible to have modules with multiple inputs?If so ,how can I

azure-iot-edge
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.

obloch avatar image
1 Vote"
obloch answered

Hi @samkris-5887,

You can definitively have several inputs in a module developed in C.
Without seeing your code, it's hard to see what's going wrong.

In case you are still having the issue:
Do you see the SetInputMessageCallback function call succeed in the logs?
Is your callback function InputQueue2Callback declared ahead of the call to SetInputMessageCallback?

Another thing that could have happen is if the route has been updated but not the module binary itself. In this kind of situation you might want to stop the runtime, delete the module (to force a redeploy of the newer version) and restart the runtime.

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.

SandervandeVelde42 avatar image
0 Votes"
SandervandeVelde42 answered samkris-5887 commented

Hello @samkris-5887,

Yes. In general, an IoT Edge module can have multiple inputs and/or outputs.

Behind inputs (just represented by a name you chose), you need to implement a callback function.

At any time, you can send a message to some output. Again, it's up to you to come up with a name.

Modules do not have any knowledge about inputs or outputs on other modules, you define the routes.

If a route is misconfigured (eg. the module name is spelled wrong or the route points to non-existing inputs or outputs) nothing serious happens inside the modules. Perhaps messages are sent but these will never be picked up of an input is listening form messages which are never sent.

I have not that much experience with the C template but the message is complaining about a missing callback.

Please check your code again to see what is wrong.





· 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.

Hello @SandervandeVelde42 ,
I have a callback function as attached,which is a reused one from template "input1 " code itself.I don't see any changes required with in the callback for each input except the logics to handle the data.
I can see its already tried by others using C#,as discussed in

https://stackoverflow.com/questions/55527592/iot-edge-module-with-more-than-1-input-fails-test-with-input1-and-input2-in.


But in C ,I couldn't find any clues for multiple inputs.

0 Votes 0 ·