IoT Hub Routing Messages to Only One Partition of Event Hub

Category: azure iot hub

Question

Goliemoi on Fri, 22 Mar 2019 20:02:57


 have a data pipeline set up in Azure where I send messages to an IoTHub which then routes those messages to an EventHub. When I read from the EventHub using the standard EventProcessorHost method, I find that only one of the partitions is being read from. I assume that only one partition is actually having messages routed to it. I have not specified a partition key anywhere and expect that the messages would be routed to all of the partitions of the event hub using round robin (as per the Event Hubs documentation).

How can I configure my setup to route messages to all partitions of the event hub?

Replies

António Sérgio Azevedo - MSFT on Tue, 26 Mar 2019 20:25:01


Hi Goliemoi,

How can I configure my setup to route messages to all partitions of the event hub?

You can't do it on IoTHub. All messages from a specific device always end up on the same partition so there is some predictability. Here's the hash function to know which partition is going to be used based on the device id:

https://github.com/Azure/azure-iot-sdk-csharp/blob/master/iothub/service/src/Common/EventHubPartitionKeyResolver.cs

See also this issue for reference - it applies to all other SDKs.