IotHub only allows a single Event Trigger function?

Paul D.Smith 16 Reputation points
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.
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
Azure Event Hubs
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 36,951 Reputation points MVP Volunteer Moderator
    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

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.