如何在 Azure 事件中心消费者 java 代码中设置分区
How to set partition in azure event hub consumer java code
我想知道 EventProcessHost 中主机名的用途以及如何在消费者端设置分区。现在我能够从消费者组获取数据,但所有分区都进入输出流。
问题:
1.How 通过代码 java 设置分区。
EventProcessHost 中主机名的 2.Use
3.example 对于多用户,每个用户在 java 代码中都有自己的分区。
非常感谢任何帮助。
有完整的Java例子,见the docs
使用EventProcessHost
时不需要设置分区。相反,每个实例将租用一个它将在其上工作的分区。因此,如果您使用 4 个分区创建事件中心,则应实例化 4x EventProcessHost
以获得更好的吞吐量。另请参阅链接文档:
This tutorial uses a single instance of EventProcessorHost. To increase throughput, it is recommended that you run multiple instances of EventProcessorHost, preferably on separate machines. This provides redundancy as well. In those cases, the various instances automatically coordinate with each other in order to load balance the received events.
租约仅在特定时间内发出。之后,另一个接收者可以接管该租约。如果稍等片刻,您会注意到所有实例都将检索数据。
关于主机名:
When receiving events from different machines, it might be useful to specify names for EventProcessorHost instances based on the machines (or roles) in which they are deployed.
我想知道 EventProcessHost 中主机名的用途以及如何在消费者端设置分区。现在我能够从消费者组获取数据,但所有分区都进入输出流。
问题: 1.How 通过代码 java 设置分区。 EventProcessHost 中主机名的 2.Use 3.example 对于多用户,每个用户在 java 代码中都有自己的分区。
非常感谢任何帮助。
有完整的Java例子,见the docs
使用EventProcessHost
时不需要设置分区。相反,每个实例将租用一个它将在其上工作的分区。因此,如果您使用 4 个分区创建事件中心,则应实例化 4x EventProcessHost
以获得更好的吞吐量。另请参阅链接文档:
This tutorial uses a single instance of EventProcessorHost. To increase throughput, it is recommended that you run multiple instances of EventProcessorHost, preferably on separate machines. This provides redundancy as well. In those cases, the various instances automatically coordinate with each other in order to load balance the received events.
租约仅在特定时间内发出。之后,另一个接收者可以接管该租约。如果稍等片刻,您会注意到所有实例都将检索数据。
关于主机名:
When receiving events from different machines, it might be useful to specify names for EventProcessorHost instances based on the machines (or roles) in which they are deployed.