我正在使用 Azure EventHub 来处理客户事件。
客户 ID 用作 EventHub 的分区键。该 key 将被散列并用于选择 EventHub 分区。给定客户的所有事件最终都将位于同一分区上。
EventHub documentation提到以下内容:
You can use a partition key to map incoming event data into specific partitions for the purpose of data organization. The partition key is a sender-supplied value passed into an event hub. It is processed through a static hashing function, which creates the partition assignment. If you don't specify a partition key when publishing an event, a round-robin assignment is used.
我的 eventhub 中有 10 个分区,现在我正在尝试映射哪些客户最终使用相同的分区 ID。提供所有客户 ID 的列表。
但是,我找不到有关 EventHub 用于确定匹配的分区 ID 的确切哈希函数的文档。
如果这不可用,确定给定分区键的分区 ID 的最佳方法是什么。
最佳答案
该算法没有公开记录,也没有支持的方法来确定给定键的分配分区。强烈建议您的应用程序不要假设它可以可靠地重现服务哈希。
如果您需要了解数据出现在哪些分区中,建议您的应用程序在发布事件时分配特定的分区。
总而言之,所使用的算法不是现成的标准,而是定制的变体。您需要源能够在所有情况下重现其结果。
关于azure - EventHub中的partitionkey映射到partitionid使用什么哈希函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73976998/