Search code examples
pythonazure-functionsazure-iot-hub

Connect Azure Iot Hub message route with Azure function Event Hub


Is it possible to connect a message route set as event to an azure function. I have only managed to connect to event hub compatible endpoint but not with a specific message route

I have set "EventHubName": "messages/events/valid-route" in function.json


Solution

  • Function.json should look like this for getting messages from a route. You have to define the route in the path setting

    {
      "scriptFile": "__init__.py",
      "bindings": [
        {
          "type": "eventHubTrigger",
          "name": "events",
          "direction": "in",
          "eventHubName": "%EventHubName%",
          "connection": "IoTHubTriggerConnection",
          "cardinality": "many",
          "consumerGroup": "$Default",
          "path": "valid-route"
        }
      ]
    }