问题
I have set Routes for update twin and select endpoint as events(default) supported by Iot hub but it is not working.
Here is in screenshot
Am i doing anything wrong or something is missing ? Any advice or references to other material would be appreciated.
回答1:
Your Routes setup is correct. I am guessing the problem is on the consumer side of the Azure IoT Hub events (default endpoint). You can use for test purpose a Device Explorer tool. The following screen snippet shows my example:
other quick option to consume these events is creating a azure function
using System;
public static void Run(string myIoTHubMessage, TraceWriter log)
{
log.Info($"C# IoT Hub trigger function processed a message: {myIoTHubMessage}");
}
function.json file:
{
"bindings": [
{
"type": "eventHubTrigger",
"name": "myIoTHubMessage",
"direction": "in",
"path": "myPath",
"connection": "myevents_IOTHUB",
"consumerGroup": "$Default",
"cardinality": "many"
}
],
"disabled": true
}
- One more thing, you can press the button Run for testing a match. It should be shown Result:Match
回答2:
Finally, I got solution i just switch to another account and setup everything from scratch it is working perfectly fine.
The only difference i notice is location in my old account Location in WEST US and in new account in CENTRAL US. I don't find the exact solution but it's working for me. But i am still wondering is it location based issue or something else?
来源:https://stackoverflow.com/questions/46196423/how-to-implement-routes-functionality-for-twin-change-in-azure-iot-hub