0

我们使用 dapr 和输入绑定来使用来自 Azure 事件中心的 IoT 事件。事件中心有 32 个分区,发送方使用设备 ID 作为分区键。接收事件的控制器将它们委托给 dapr Actors 进行处理。

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

但是测试表明事件是同步接收的。在前一个事件的完整处理完成后,立即接收后续事件。

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

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

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

4

1 回答 1

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.
于 2021-03-16T06:24:34.717 回答