IotHub only allows a single Event Trigger function?

Paul D.Smith 1 Reputation point
2022-08-12T16:36:10.297+00:00

I am developing an IoT hub event trigger function and seem to be seeing that if multiple functions are running, only one receives events. Is this a limitation or can I somehow set up routing so that all of my functions receive the same event?

FYI the functions I have are:

  1. A C# script function which I originally created on the Azure portal
  2. A .Net C# function running locally for testing
  3. The same .NET C# function running having been deployed to Azure.

Thanks.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,323 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,128 questions
Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
563 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde 29,196 Reputation points MVP
    2022-08-12T20:48:47.833+00:00

    Hello @Paul D.Smith ,

    you want to connect multiple Azure Functions all listening to the same messages flowing through the IoT Hub.

    Yes, this is possible!

    You probably tried this out and got some errors? Or no messages at all?

    There is a simple fix for this, consumer groups.

    The IoT Hub exposes an event hub compatible endpoint. Each consumer (the Azure functions) wants to have their own copy of each message.

    To separate the stream administration, you have to specify multiple consumer groups:

    230719-image.png

    So, do not 'reuse' the $default. Actually, I recommend not using $default in production. Most tools want to use that $default one by default so it is easy to disturb that flow.

    Extra: If you start using IoT Hub routing, the endpoint will turn into a fallback route. To restore the this, create an extra 'events' route:

    230883-image.png

    ----------

    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. By doing so, all community members who have a similar issue will benefit. Your contribution is highly appreciated.

    1 person found this answer helpful.
    0 comments No comments