How to implement Routes functionality for Twin Change in Azure Iot-hub?

北城以北 提交于 2019-12-11 10:40:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!