I’m loosely following along this article to develop and debug modules for IoTEdge
https://learn.microsoft.com/en-us/azure/iot-edge/how-to-visual-studio-develop-module?view=iotedge-2020-11
The article leverages the iotedgehubdev which is where, presumably, the configuration exists to expose port 53000.
My question is, without using the simulator or iotedgehubdev tool, how do I configure the port to allow messages to be sent using this type of syntax
curl –header "Content-Type: application/json" –request POST –data ‘{"inputName": "input1","data":"hello world"}’ http://localhost:53000/api/v1/messages
// Register callback to be called when a message is received by the module
await ioTHubModuleClient.SetInputMessageHandlerAsync("input1", PipeMessage, ioTHubModuleClient);
static async Task<MessageResponse> PipeMessage(Message message, object userContext)
{
....
}
Target environment: Ubuntu, IoTEdge 1.1.4, published via IoTHub pulled from ACR
Development: Windows 11, Visual Studio 2022, debug via SSH to docker module on Ubuntu
Once the module is up and running, I want to send a post request to the module from the Ubuntu machine hosting the module. The module is being published from IoTHub
I’ve looked across many articles for clues on how port 53000 is setup and listening but haven’t found anything that helps so far.
Appreciate the help.
2
Answers
Sending a message is now easy, once your code is running on Simulator, you can send messages by issuing a CURL request to the endpoint you received when starting the Simulator. Please follow below Reference in which we have detailed information about:
Even I looked across many articles for clues. How to Set up port 53000 without using the simulator or iotedgehubdev tool. if you want to work without using the simulator or iotedgehubdev.
you can reach out to Azure Support or Can raise a GitHub Issue.
You can refer this article( Azure IoT Edge Simulator — Easily run and test your IoT Edge application | by Xavier Geerinck | Medium ) by Xavier Geerinck
We have to build a custom API module which will listen to the port just what the iotedgedev utility is doing, in which ever language you are writing it in.
Create a Rest API.
Use Azure Devices Module Client module with IOTEdge enable in project file.
Create an output in your custom API module and send the message using module client.
Create the route config in you deployment file and provide the output of this module output to the input of another module in the routes section.
Edit: Do not forget to mention the createOptions Portbindings and the Exposed Ports section, like for e.g