物联网集线器仅将消息路由到事件中心的一个分区 [英] IoT Hub Routing Messages to Only One Partition of Event Hub

查看:52
本文介绍了物联网集线器仅将消息路由到事件中心的一个分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


 在Azure中设置数据管道,我将消息发送到IoTHub,然后将这些消息路由到EventHub。当我使用标准的EventProcessorHost方法从EventHub读取时,我发现只读取了一个分区。
我假设只有一个分区实际上有消息路由到它。我没有在任何地方指定分区键,并且期望使用循环法将消息路由到事件中心的所有分区(根据事件中心文档)。



如何配置我的设置以将消息路由到事件中心的所有分区?

解决方案

嗨  Goliemoi


我如何配置我的设置是将消息路由到事件中心的所有分区吗?


您无法在IoTHub上执行此操作。来自特定设备的所有消息总是在同一分区上结束,因此具有一定的可预测性。这是哈希函数,根据设备ID知道要使用哪个分区:


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


另请参阅此问题供参考 - 它适用于所有其他SDK。


 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?

解决方案

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.


这篇关于物联网集线器仅将消息路由到事件中心的一个分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆