与Azure事件中心的Dapr输入绑定同步处理消息



我们使用dapr和输入绑定来消费Azure Event Hub中的IoT事件。事件集线器有32个分区,发送方使用设备id作为分区密钥。接收事件的控制器将事件委托给dapr Actors进行处理。

现在我的期望是,每个分区中的消息都是并行处理的,从而导致对接收事件的控制器的并行请求,从而允许处理多达32个并发事件批。

然而,测试表明,这些事件是同步接收的。随后的事件是在前一事件的完全处理刚刚完成之后接收的。

现在我知道actors是通过设计一个接一个地处理消息的,但根据文档,我没有读到输入绑定的类似内容。

有什么我完全不知道的吗?否则,我无法想象这个系统是如何扩展的。

我们使用dapr 0.11和运行在AKS集群中的ASP.NET Core 3.1。

我刚刚在GitHub上得到了一个答案:https://github.com/dapr/components-contrib/issues/759

因此,这基本上证实了我基于当前版本的dapr事件集线器绑定的观察结果。

但是,您可以手动配置每个dapr组件的分区ID。因此,要同时从32个分区中读取,您目前必须使用32个dapr组件,每个组件都从一个单独的分区中读取。

引用上面的GitHub问题:

[...] you can specify a Dapr component per partition ID: https://docs.dapr.io/operations/components/setup-bindings/supported-bindings/eventhubs/
If you set the partitionID field on the component metadata, the consumer will pull all messages for that partition ID.
Otherwise, it'll pull from all partitions.

最新更新